Nov 15, 2017

[Solution] How to empty a data grid in jeasyui ?

Question :

I have a data grid with 1000 records when i perform a search on a table, i need to remove all records in the data grid when i call a method, how can i do that ?

Answer :

1. We could load an empty data set to the data grid.
    $('#dg').datagrid('loadData', {"total":0,"rows":[]});

2. We could remove only the selected records in the data grid.

var rows = $('#tt').datagrid('getSelections');  // get all selected rows
for(var i=0; i<rows.length; i++){
var index = $('#tt').datagrid('getRowIndex',rows[i].id);  // get the row index
$('#tt').datagrid('deleteRow',index);
}


No comments:

JWT Token Decode Using Jquery

When it come to authentication we use many mechanism. Ones the user authenticated we must keep these details somewhere safe. So we can share...