We have a module, for example, to select "region" and "Maintenance Agency", refresh the first DataGrid frame.
Click the behavior data condition in the first result set to complete the search of the next frame.
Now we have completed the corresponding functions, and automatically refresh the first DataGrid (DG1) result set after selecting "region" and "Maintenance Agency" and ensuring that both options have values at the same time.
However, after the DG1 refresh is completed, the subsequent two DG2 and DG3 are followed by the previous results.
I tried to change the query conditions of DG2 and DG3 by manually passing an empty ID value to the query () method, but it was returned as the first query by the Controller layer in the background.
So we can find such a method and give them an empty result set string.
As follows:
Copy codeThe Code is as follows:
// Modify the selection box of Maintenance Agency and submit the query again
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, lines are written dead, And tabs are optimized later.
If (params. company_id = "" | params. region = ""){
Return;
}
$ ("# Dg1"). datagrid ('load ');
$ ('# Dg2'). datagrid ('loaddata', {total: 0, rows: []}); // clear the DateGrid below
$ ('# Dg3'). datagrid ('loaddata', {total: 0, rows: []}); // clear the DateGrid below
}
In this way, the result set data in DG2 and DG3 can be cleared smoothly.
Another method is to traverse and delete the data in the result set.
Copy codeThe Code is as follows:
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 ('delterow ', index );
}
}
Same things