插入新记录后如何突出显示jqgrid行

时间:2014-02-13 12:31:09

标签: jqgrid

我试图在jqgrid中尝试突出显示新的插入记录this link

但是afterCompleate没有触发,尝试gridview:false没有运气,使用mvc 4和jqgrid版本4.4.4 ........................ ....................................

<script type="text/javascript">
jQuery(document).ready(function () {
    jQuery('#GridList').jqGrid({
        autoencode: true,
        autowidth: true,
        caption: 'List',
        datatype: 'json',
        jsonReader: { 'repeatitems': false, 'id': 'dataJson' },
        emptyrecords: 'No record Found',
        gridview: true,
        height: '100%',
        loadui: 'block',
        pager: '#pager',
        rowList: [10, 15, 20, 50],
        rowNum: 20,
        viewsortcols: [true, 'vertical', true],
        shrinkToFit: true,
        url: '@Url.Action("List")',
        viewrecords: true,
        width: '650',
        colModel: [
            @if (permissions.WriteAccess)
        {
            @Html.GetGridCustomColumn(model => model.Id,"Edit","&nbsp;","EditLink",18) @:,
            @*@Html.GetGridCustomColumn(model => model.Id,"Delete","&nbsp;","DeleteLink",18)*@
        }
            @Html.GetGridCustomColumn(model => model.Id, "Details", "&nbsp;", "DetailLink", 18),
            @Html.GetGridColumn(model => model.LicenceNumber),
            @Html.GetGridColumn(model => model.EntityName),
            @Html.GetGridColumn(model => model.EntityTypeName),
            @Html.GetGridColumn(model => model.StartDate),
            @Html.GetGridColumn(model => model.EndDate),
            @Html.GetGridColumn(model => model.LicenceStatus),
            @Html.GetGridColumn(model => model.LicenceType),
            @Html.GetGridColumn(model => model.LicenseApplicationStatus)
        ]
    }).jQuery('#GridList').jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false }),
    jQuery("#GridList").navGrid('#pager', { edit: true, add: true, del: false });

    afterComplete: function (response,postdata) {
        alert("new record added");
    };

});

1 个答案:

答案 0 :(得分:0)

afterCompleate 是表单编辑事件,实际上不是Grid事件。 您可以使用 afterCompleate 作为添加事件:

$("#list").jqGrid({
    //  jqGrid options
}).jqGrid('navGrid', '#pager', {/*navGrid options*/}, {/*Edit optoins*/}, {
    /*Add options:*/
    afterComplete: function (response, postdata) {

    }
});