现在我们已完成相应功能,并在选择“地区”及“代维公司”并保证这两个选项同时有值后,自动刷新第一个DataGrid(DG1)结果集

但是在DG1刷新完毕后,后面两个紧跟的DG2及DG3还是保有">
Home > Web Front-end > JS Tutorial > DataGrid result set clearing method in EasyUI component under Jquery_jquery

DataGrid result set clearing method in EasyUI component under Jquery_jquery

WBOY
Release: 2016-05-16 17:05:16
Original
1611 people have browsed it

We have a module as shown below. After selecting "Region" and "Agency Company", refresh the first DataGrid frame

and click to complete the next frame based on the behavioral data conditions in the first result set. Search

DataGrid result set clearing method in EasyUI component under Jquery_jquery

Now we have completed the corresponding function, and after selecting "Region" and "Agency Company" and ensuring that these two options have values ​​at the same time, the first page will be automatically refreshed A DataGrid (DG1) result set

But after DG1 is refreshed, the two following DG2 and DG3 still retain the previous results

I tried to change the query conditions of DG2 and DG3 , manually passing an empty ID value to the query() method, but it was later treated as the first query return by the background Controller layer

So I found such a method that can give them an empty result set string

As follows

Copy the code The code is as follows:

//Modify the maintenance company selection Resubmit the query after the box
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 written as line, Later, it will be optimized into a tab page
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 data in the result set in DG2 and DG3 can be cleared smoothly

Another method is to traverse and delete the data in the result set
Copy the code The 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('deleteRow' , index);
}
}

Different paths to the same destination
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template