If you pass the following as your search criteria for the dropdown it should work
:All;true:Yes;false:No
I also am using JQGrid and this satisfies my needs.
if you have the blank string it will not pass the criteria to the server side.
質問
I have set up a JQGrid
in my ASP.NET MVC project
. My datasource objects have a bool
property, which I want to search against with JQGrid
.
I have set up a select menu in the filter toolbar, but I'm unable to place an "All"
item in the first place, which would clear the filter on that specific column. The issue is that whenever I select "Yes"
for example in one column, in the post parameters I always see a filter with value "" or -1
, or whatever I set for the "All"
option's value for all other boolean columns, which of course break the server-side search.
{
"stype": "select",
"index": "Validated",
"searchoptions": {
"sopt": ["eq", "ne"],
"value": "-1:All;true:Yes;false:No" },
"name": "Validated"
}
And my post data:
filters: {"groupOp":"AND","rules":[{"field":"Activated","op":"eq","data":"true"},{"field":"Validated","op":"eq","data":"-1"}]}
On the server-side I have used Trirand's ASP.NET MVC JQGrid
suite for databinding and automatic processing.
解決
If you pass the following as your search criteria for the dropdown it should work
:All;true:Yes;false:No
I also am using JQGrid and this satisfies my needs.
if you have the blank string it will not pass the criteria to the server side.