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)