|
graveytrain
|
 |
« on: November 03, 2014, 02:49:07 PM » |
|
I am trying to delete some rows that are coming back after delete when I sort. (reload url with sort and order). the data comes back obviously with the deleted rows. So when I delete them I push them to and array. when I sort the datagrid again on a column it pulls back the data, then I was going to loop through and remove the rows manually in the onLoadSuccess event. However the getRowIndex gives me back the ole -1 everytime.
function addDeleteRow(rows){ for(var i = 0; i < rows.length; i++){ deletedRows.push(rows); } }
$('#outagetable').datagrid({ url:'./scripts/outages.php?date=' + date + '&type=' + $("input[name=types]:checked").val(), columns:[[ {field:'tradedate', title:'Tradedate', width:70, sortable:true}, {field:'he', title:'HE', width:35, sortable:true}, {field:'hours_out', title:'HR Out', width:45, sortable:true}, {field:'company', title:'Company', width:65, sortable:true}, {field:'kv', title:'KV', width:45, sortable:true}, {field:'from_station', title:'From', width:85, sortable:true}, {field:'to_station', title:'To', width:85, sortable:true}, {field:'ems_equipment', title:'Equipment', width:220, sortable:true}, {field:'planned_start', title:'Planned Start', width:120, sortable:true}, {field:'planned_end', title:'Planned End', width:120, sortable:true}, {field:'actual_start', title:'Actual Start', width:120, sortable:true}, {field:'actual_end', title:'Actual End', width:120, sortable:true}, {field:'request_status', title:'Status', width:90, sortable:true}, {field:'priority', title:'Priority', width:90, sortable:true}, {field:'equip_req_type', title:'Request Type', width:90, sortable:true}, {field:'from_ca', title:'From CA', width:60, sortable:true}, {field:'to_ca', title:'To CA', width:60, sortable:true}, {field:'what', title:'Status', width:90, hidden:false, sortable:true} ]], onLoadSuccess:function(){ for(var i = 0; i < deletedRows.length; i++){ var index = $(this).datagrid('getRowIndex', deletedRows); //alert(JSON.stringify(deletedRows)); //alert(index); //$(this).datagrid('deleteRow', index); } } });
there is a bit of the offending code. Might not be a bug, might just be a lose nut between the chair and the keyboard
|