开发者

bug in jqgrid, only the first search shows a dropdown

开发者 https://www.devze.com 2023-02-18 07:10 出处:网络
i am using a toolbar filter (mostly select dropdowns) and multiple advanced filter.This works fine except if i programatically set a bunch of filters and then load up the dropdown it takes the first e

i am using a toolbar filter (mostly select dropdowns) and multiple advanced filter. This works fine except if i programatically set a bunch of filters and then load up the dropdown it takes the first entry and converts the textbox to a dropdown and only shows me "Equals" in the operation dropdown.

The issue is all other items will still show textboxes. here is a picture:

bug in jqgrid, only the first search shows a dropdown

you see how the first row has a dropdown but the other rows are textboxes. If this was working properly they all would be textboxes. Also, the operation default is not defaulting to "Equals"

Here is my code:

On startup i programatically set some filters:

var myfilter = { groupOp: "AND", rules: [] };
myfilter.rules.push({ field: "Status", op: "ne", data: "Completed" });
myfilter.rules.push({ field: "Status", op: "ne", data: "On Hold" });
myfilter.rules.push({ field: "Status", op: "ne", data: "Cancelled" });


[a bunch of code to initialize grid . . .]   
postData: { filters: JSON.stringify(myfilter) },

Also, here is the colModel for the status column:

{ name: "Status", index: "Status", width: 55, stype: 'select', searchoptions: { sopt: ['eq'], dataUrl: "/Project/StatusGetSelectData1"} 开发者_如何学编程},

then all i do i click on the Search button (i have multiplesearch: true)

So because the "Status" column is stype: "select" it seems to only show me the "equal" operator in the operator dropdown (which defeats the purpose of advance filter) and on the first item on the advance filter converts to a select with the items from the select but:

  1. It doesn't default the value of the operation to "equal" as you can see it keeps it blank
  2. The other filters below DONT convert to dropdown (they stay textboxes) and also don't default to equals

Update:

One problem is fixed as i didn't have 'ne' in the sopts setting for this field. i now see this:

bug in jqgrid, only the first search shows a dropdown

Also, Oleg below asked to see the output of DataUrl:. Oleg, all i do is get the list of values and shove it into the dropdown view (see below)

<select>
<option value="">(None)</option>
<%
foreach (var pair in Model)
{
    %><option value="<%= pair.Value %>"><%= pair.Value %></option>
<%    
}
%></select>

Update:

This is now fixed in jqGrid 4.0


One clear error in your code: you use op: "ne" in the filter but define only 'eq' as the only permitted compare operation searchoptions: { sopt: ['eq'], ...}. I recommend you to use the full list of operations in sopt and just set 'eq' as the first element of the sopt array.

UPDATED: I can confirm that there is the bug in the jquery.searchFilter.js module of jqGrid. Here is the code which can be used to reproduce the problem which you also has. I can not find some quick bug fix. Like I previously wrote you the jquery.searchFilter.js module will be replaced on the new written module grid.filter.js in the next version of jqGrid. How you can see here the problem which you describe in your question not exist in the new module. So I am not sure that the old module will be ever fixed. The main problem that the old module uses some functions like jQuery.clone which are buggy in jQuery 1.4.x and 1.5.x and the bugs will be probably fixed in the version 1.6 only. So to fix some problems existing in jquery.searchFilter.js module one have to rewrite many its parts.

On the other side during the tests I found at least 5 bugs in the new module which I will report to trirand later. So you should just take a patience and wait for the next release of jqGrid or at least till the version on https://github.com/tonytomov/jqGrid/ will be more stable.

0

精彩评论

暂无评论...
验证码 换一张
取 消