The DataGrid result set emptying method in the EasyUI component under Jquery

  • 2020-03-30 01:16:15
  • OfStack

We have a module shown below that requires us to refresh the first DataGrid box after selecting "region" and "dve"

And click on the behavior data condition of the first result set to complete the retrieval of the next box

< img SRC = "border = 0 / / 201406164240 ">  

Now that we have done so, we automatically refresh the first DataGrid (DG1) result set after selecting "locale" and "d&d company" and ensuring that both options have values

However, after the refresh of DG1, the two immediately followed DG2 and DG3 still retain the previous results

I tried to change the query criteria for DG2 and DG3 by manually passing an empty ID value to the query() method, but it was later returned as the first query by the Controller layer in the background

So you find a method that gives them an empty result set string

The following
//Resubmit the query after modifying the dve marquee
function query1(){ 
var params = $('#dg1').datagrid('options').queryParams; 
params.region = $('#region').combotree('getValue'); 
params.company_id = $('#company_id').combotree('getValue'); 
params.contract_type = "line";//* currently write dead for the line, later optimization for the TAB
if(params.company_id == "" || params.region == ""){ 
$('#dg2').datagrid('loadData', { total: 0, rows: [] });//Clear the DateGrid below
$('#dg3').datagrid('loadData', { total: 0, rows: [] });//Clear the DateGrid below

In this way, the data of the result set in DG2 and DG3 can be cleared successfully

Another way is to iterate over and delete the data in the result set
var item = $('#filegrid').datagrid('getRows'); 
if (item) { 
for (var i = item.length - 1; i >= 0; i--) { 
var index = $('#filegrid').datagrid('getRowIndex', item[i]); 
$('#filegrid').datagrid('deleteRow', index); 

All roads lead to Rome

Related articles: