add_event()

  • Parameter(s):
    • $event_name: Event name from one of the following available events
        • jqGrid events

           

        • jqGridAfterAddRow
        • jqGridAfterChangeRowid
        • jqGridAfterDelRow
        • jqGridAfterInsertRow
        • jqGridAfterLoadComplete
        • jqGridAfterSetRow
        • jqGridAfterResizeDblClick
        • jqGridBeforeInitGrid
        • jqGridBeforeProcessing
        • jqGridBeforeRequest
        • jqGridBeforeSelectRow
        • jqGridGridComplete
        • jqGridLoadBeforeSend
        • jqGridLoadComplete
        • jqGridDblClickRow
        • jqGridHeaderClick
        • jqGridInitGrid
        • jqGridPaging
        • jqGridRightClickRow
        • jqGridSelectAll
        • jqGridSelectRow
        • jqGridShowHideCol
        • jqGridSortCol
        • jqGridRemapColumns
        • jqGridResizeDblClick
        • jqGridResizeStart
        • jqGridResizeStop
        • jqGridResetFrozenHeights
        •  

          Grouping event

           

        • jqGridGroupingClickGroup
        •  

          Form editing events

           

        • jqGridAddEditAfterClickPgButtons
        • jqGridAddEditAfterComplete
        • jqGridAddEditAfterShowForm
        • jqGridAddEditAfterSubmit
        • jqGridAddEditBeforeCheckValues
        • jqGridAddEditBeforeInitData
        • jqGridAddEditBeforeShowForm
        • jqGridAddEditBeforeSubmit
        • jqGridAddEditClickPgButtons
        • jqGridAddEditClickSubmit
        • jqGridAddEditInitializeForm
        • jqGridAddEditSerializeEditData
        •  

          Form view events

           

        • jqGridViewBeforeInitData
        • jqGridViewBeforeShowForm
        •  

          Form deleting events

           

        • jqGridDeleteAfterShowForm
        • jqGridAddEditAfterComplete
        • jqGridDeleteBeforeInitData
        • jqGridDeleteBeforeShowForm
        • jqGridAfterDelRow
        •  

          Searching form

           

        • jqGridFilterAfterChange
        • jqGridFilterAfterShow
        • jqGridFilterInitialize
        • jqGridFilterBeforeShow
        •  

          Inline editing events

           

        • jqGridInlineBeforeAddRow
        • jqGridInlineBeforeCancelRow
        • jqGridInlineBeforeEditRow
        • jqGridInlineBeforeSaveRow
        • jqGridInlineAfterRestoreRow
        • jqGridInlineEditRow
        • jqGridInlineSaveRowValidation
        • jqGridInlineAfterSaveRow
        • jqGridInlineSerializeSaveData
        • jqGridInlineSuccessSaveRow
        • jqGridInlineErrorSaveRow
        •  

          Cell editing events

           

        • jqGridBeforeEditCell
        • jqGridAfterEditCell
        •  

          Subgrid events

           

        • jqGridSerializeSubGridData
        • jqGridSubGridBeforeCollapse
        • jqGridSubGridBeforeExpand
        • jqGridSubGridRowExpanded
    • $js_event_handler: JavaScript event handler to the specified event
  • Description:
  • Remark:
    • This is an advanced method.  The event handlers are essentially JavaScript.
    • Native javascript events are always supported.
  • Example:

You can also add event handler directly, even add additional event handler. The following adds dropdown ‘change’ event handler when the edit form shows.

1
2
3
4
5
6
7
8
9
10
11
<script type="text/javascript">
$(function() {
        var grid = jQuery("#orders");

        grid.bind('jqGridAddEditAfterShowForm', () => {
            document.getElementById('status')?.addEventListener('change',
                () =>  console.log(this)
            );
        })
    });
</script>