Easyui the DataGrid: How to reset the properties configured by the DataGrid (options) and requery the list (relaod)

Source: Internet
Author: User

http://www.stepday.com/topic/?873

Today the DataGrid list component using Easyui wants to implement a list, and there are search criteria above the list, which I configured when initializing:

View Sourceprint? 1. < table id = "tBaoXiuList" title = "" class = "easyui-datagrid" style = "width: 723px; height: auto" url = "/AjaxCommon/t_baoxiu_ajax.asp?type=getIndexList" toolbar = "#bar_search" pageSize = "30" pagination = "true" rownumbers = "true" fitcolumns = "true" singleselect = "true" > 2.  3. </ table >

This allows the data to be queried according to the parameters. However, when I want to filter data based on query parameters, it is necessary to add parameters to the default URL to go after the line.

The idea is to start with the Datagri attribute queryparams:

View Sourceprint? 1. $( ‘#tBaoXiuList‘ ).datagrid({ 2. queryParams:{ 3. keyName:keyName, 4. keyVal:keyVal 5. } 6. }); 7.  8. $( ‘#tBaoXiuList‘ ).datagrid( "reload" );

It turns out that this does not pass parameters to the background page for data filtering.

The last way to think of this is to first find and URL through the Datagtrid options property, modify the URL and then request the data through reload again, the sample code is as follows:

View Sourceprint? 1. var  keyName = $( "#txtKeyName" ).combobox( "getValue" ); 2. var  keyVal = $( "#txtKeyVal" ).val(); 3.  4. $( ‘#tBaoXiuList‘ ).datagrid( ‘options‘ ).url =  "/AjaxCommon/t_baoxiu_ajax.asp?type=getIndexList&keyName="  + keyName +  "&keyVal="  + escape(keyVal); 5. $( "#tBaoXiuList" ).datagrid( ‘reload‘ );

The example effect is as follows:

Easyui the DataGrid: How to reset the properties configured by the DataGrid (options) and requery the list (relaod)

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.