jqGrid highlight the new added row

后端 未结 3 1832
长情又很酷
长情又很酷 2020-12-13 22:47

Is that possible to highlight the new added row in jqGrid. The highlight effect is something like this Highlight Effect

So, when the new row is added, the row wi

3条回答
  •  攒了一身酷
    2020-12-13 23:17

    If I understand you correct you want highlight a row added with respect of form editing ("+" in the navigation bar). Form editing supports an event afterComplete, which you can use to add some post-edditing features. For example, if you want to have the highlight effect with all rows added, then you can use general setting for jQuery.jgrid.edit:

    jQuery.extend(jQuery.jgrid.edit, {
        reloadAfterSubmit: false,
        afterComplete : function (response, postdata, formid) {
            if (postdata.oper === "add") { // highlight on "add" only
                var row = jQuery ("#"+$.jgrid.jqID(postdata.id), jQuery(this.gbox));
                row.effect("highlight", {color:"red"}, 3000);
            }
        }
    });
    

    If you will be use row.effect("highlight", {}, 3000); (no red color), you will see highlight effect, but a little not so clear, because added row will be selected per default.

    You can of cause modify the code to use highlighting only for one selected grid.

提交回复
热议问题