The DataGrid result set vacuuming method in the Easyui component of jquery _jquery

Source: Internet
Author: User
We have a module below, which requires selecting "Region" and "Dai-wei Company" to refresh the first DataGrid frame body

and click to complete the search of the next frame with the behavior data condition of the first result set.



Now that we have completed the function, we will automatically refresh the first DataGrid (DG1) result set when we select "Region" and "Company" and guarantee that both options have a value

But after the DG1 has been refreshed, the following two DG2 and DG3 are still the results

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

So we found a way to give them an empty result set string

As follows
Copy Code code as follows:

Re-submit a query after modifying the surrogate-dimension company 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";//* is currently written dead for lines, and later optimized for label pages
if (params.company_id = = "" | | Params.region = = "") {
Return
}
$ ("#dg1"). DataGrid (' Load ');
$ (' #dg2 '). DataGrid (' LoadData ', {total:0, rows: []});/clear Dategrid below
$ (' #dg3 '). DataGrid (' LoadData ', {total:0, rows: []});/clear Dategrid below
}

This will smooth out the data for the result set in DG2 and DG3.

There is also a way to traverse and delete data in the result set
Copy Code code 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);
}
}

Converging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.