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

前端 未结 2 1861
失恋的感觉
失恋的感觉 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;
                        }
                    }
                }
            }
        }
    }
    

提交回复
热议问题