jqGrid: how to update row id if primary key columns was edited

前端 未结 2 1837
失恋的感觉
失恋的感觉 2021-01-25 23:37

Primary key values are used as row ids in json data returned from server. If primary key value is edited and saved two times, second save causes error since jqGrid passes origin

相关标签:
2条回答
  • 2021-01-26 00:20
    #gridPreSeleccion = id grid
    grid multiselect=true
    function eliminarSeleccionados() {
        var idsContribuyentesSelect = jQuery("#gridPreSeleccion").jqGrid('getGridParam', 'selarrrow');
        if(idsContribuyentesSelect.length == 0) {
            jQuery.MessageAlertSath("Es necesario seleccionar una fila.")
        } else {
            var ids = jQuery("#gridPreSeleccion").jqGrid('getDataIDs');
            var a = ids.length;
            var j = 0;
            while(j == 0) {
                if(jQuery("#gridPreSeleccion").jqGrid('getGridParam', 'selarrrow').length <= 0) {
                    j = 1;
                } else {
                    for(var i = 0; i < a; i++) {
                        if(idsContribuyentesSelect[0] == ids[i]) {
                            jQuery('#gridPreSeleccion').delRowData(ids[i]);
                            break;
                        }
                    }
                }
            }
        }
    }
    
    0 讨论(0)
  • 2021-01-26 00:42

    The rowid is nothing more as the value of id attribute of the corresponding <tr> element of the grid. So to change the rowid oldRowid to newRowid you should do something like the following:

    $("#" + oldRowid).attr("id", newRowid);
    
    0 讨论(0)
提交回复
热议问题