jQWidgets Forums
jQuery UI Widgets › Forums › Grid › jqxGrid – filter checkedlist
Tagged: angular grid, bootstrap grid, javascript grid, jquery grid, jqwidgets grid, jqxgrid filtering
This topic contains 6 replies, has 2 voices, and was last updated by Christopher 8 years, 7 months ago.
-
Author
-
Hi,
In order to help me to describe my request, you could find a demo sample of my problem on the following link.
http://jsfiddle.net/Franck_Serot/osoo2nak/
The grid has 2 columns :
– The column LABEL contains ‘one’, ‘two’ three’ and a filter that allows to filter rows with the same values.
– The column ID contains ‘1 – one’, ‘2 – two’, ‘3 – three’ and a filter configured with the values ‘one’, ‘two’, ‘three’.I search filter the 2 columns with the same filter type.
The column LABEL can be filtered with the value ‘one’.
But, the column ID can’t be filtered with the value ‘one’ because :
– the column ID manage data with an integer type : ‘1’ for example
– and the column ID is displayed with a template : ‘1 – one’ for exampleI search to use a callback in order to adapt the filter on the column ID.
For example,
If the column ID is filtered with the value ‘one’ then
– either the value ‘one’ is replaced by ‘1’ before the comparaison
– or the value ‘one’ is searched in the label ‘1 – one’According to the jqxWidget documentation, the column propertie exists :
filter – sets the column’s initialization filter. A $.jqx.filter object is expected.Could you explain to me how to solve my problem eventually with this column’s propertie ?
Thank you for your response.
Best regards,
Franck
please, use this link : http://jsfiddle.net/Franck_Serot/05nk1h6u/
Hi Franck Serot,
The
cellsrenderer
function only changes the rendering ot the column, but the value remains the same. This means, that the values in the ‘ID’ column are still 1,2,3. In order to filter them you need to set a propper `filterlist’ array to the column. I updated your demo with the changes:
http://jsfiddle.net/05nk1h6u/1/If you want to customize the filter list you can use a separate source for it. Check this demo to see how this can be accomplished:
http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/grid-list-filter-with-key-value-column.htm?lightBest Regards,
ChristopherjQWidgets Team
http://www.jqwidgets.comHi Christopher,
OK for the sample http://jsfiddle.net/05nk1h6u/1/ but it’s not what I want exactly.
In fact, I search filter rows with a customized filter.
In the sample http://jsfiddle.net/05nk1h6u, the columns ‘LABEL’ can be filtered with a filter : cellvalue ‘EQUAlS’ “one”
I try to use the callback createfilterwidget on the column ‘LABEL’ in order to replace the filter by a customized filter : cellvalue ‘CONTAINS’ “one”
The following link describes the result : the filter widget is instable, the behaviour is bad and the sample crashs. 🙁
http://jsfiddle.net/Franck_Serot/05nk1h6u/2/
Could you explain to me how to solve my problem ?
Thank you for your response.
Best regards,
Franck
Hi Franck Serot,
The checkedlist filter works with boolean values. You know that checkboxes expect such values. This means that in terms of filtering, you should use equal or not_equal filters. I prepared a working sample which shows how to set predefined filter to checkedlist Filter Column: http://jsfiddle.net/b0nw9c3r/
Also
createfilterwidget
function is used to set up additional settings of the filter widget, not to create or apply filters in it. Creating and applying custom filters should be done in a separate function like in the example I provided, a function called “addFilter()”. It should be called when the jqxGrid is completely loaded , in it’sready
function. Another thing that I notice now, don’t use the word “label” in the “data” Array, because it’s a reserved word. You can change it to, for example, “mylabel” or sth else, but not “label”.Best Regards,
ChristopherjQWidgets Team
http://www.jqwidgets.comHi Christopher,
Thank you for your advice.
I simplify my sample : http://jsfiddle.net/Franck_Serot/05nk1h6u/4/
Is it possible to adapt the filter in order to compare cellvalue with filter operator ‘CONTAINS’ and not ‘EQUAL’ ?
Thank you for your response.
Best regards,
Franck
Hi Franck Serot,
Unfortunately, no, it’s not possible to do that. If you want to use the “CONTAINS” filter operator you need to change the
filtertype
to one that works with strings, like “input” and “textbox”.Best Regards,
ChristopherjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.