jQuery UI Widgets › Forums › Grid › Order jqx grid jqwidget filter conditions
Tagged: $.jqx, filter conditions, grid, jqwidget, order
This topic contains 3 replies, has 2 voices, and was last updated by Sibeesh Venu 9 years, 3 months ago.
-
Author
-
Hi,
I am using a JQX grid in my application. Now I need to order my filter conditions like whenever user clicks on filter icon, default filter condition must be ‘Equal’. I tried below methods. But it is not working.var localizationObject = { filterstringcomparisonoperators: ['Equal ','Starts With', 'Ends With', 'Contains', 'Does not contain', 'Empty', 'Not Empty', 'Null'], currencysymbol: "$", percentsymbol: "%", decimalseparator: ".", thousandsseparator: ",", // filter numeric comparison operators. filternumericcomparisonoperators: ['less than', 'greater than'], // filter date comparison operators. filterdatecomparisonoperators: ['less than', 'greater than'], // filter bool comparison operators. filterbooleancomparisonoperators: ['equal', 'not equal'] } //$("#jqxgrid .jqx-grid-column-header").each(function () { // $(this).jqxTooltip({ position: 'mouse', content: $(this).text() }); //}); $("#jqxgrid").jqxGrid('localizestrings', localizationObject);
And
updatefilterconditions: function (type, defaultconditions) { var stringcomparisonoperators = [ 'EQUAL ','STARTS_WITH', 'ENDS_WITH', 'CONTAINS', 'DOES_NOT_CONTAIN', 'EMPTY', 'NOT_EMPTY', 'NULL']; var numericcomparisonoperators = ['LESS_THAN', 'GREATER_THAN']; var datecomparisonoperators = ['LESS_THAN', 'GREATER_THAN']; var booleancomparisonoperators = ['EQUAL', 'NOT_EQUAL']; switch (type) { case 'stringfilter': return stringcomparisonoperators; case 'numericfilter': return numericcomparisonoperators; case 'datefilter': return datecomparisonoperators; case 'booleanfilter': return booleancomparisonoperators; } }
When I do this, The filter condition ‘Contains is not working as expected. And also the ‘Equal’ Condition is not showing in first order. But When I place ‘Equal’ condition in the third place of localization object, I is coming in the first order but filter does not work. Please help me resolve this. Thanks in advance.
Kindest Regards
Sibeesh Venu
http://www.sibeeshpassion.comHi Sibeesh,
It is demonstrated on this page: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/filterconditions.htm?arctic how to use custom filter conditions.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/I have done it by adding
updatefilterpanel: function (filtertypedropdown1, filtertypedropdown2, filteroperatordropdown, filterinputfield1, filterinputfield2, filterbutton, clearbutton, columnfilter, filtertype, filterconditions) { var index1 = 0; var index2 = 0; filtertypedropdown1.jqxDropDownList({ autoDropDownHeight: true, selectedIndex: index1 }); filtertypedropdown2.jqxDropDownList({ autoDropDownHeight: true, selectedIndex: index2 }); }
Thanks a lot for your help.
Suppose I have a grid as follows,
`$(“#jqxgrid”).jqxGrid(
{
source: data,
columns: [{ “text”: “Area Code”, “dataField”: “AreaCode”, “cellsalign”: “left”, “cellsformat”: “d” }, { “text”: “Revenue”, “dataField”: “Revenue”, “cellsalign”: “right”, “cellsformat”: “c2” }],
pageable: true,
filterable: true,
sortable: true,
rendered: function () {
var localizationobj = {};
filterstringcomparisonoperators = [‘equal’, ’empty’, ‘not empty’, ‘contains’, ‘does not contain’, ‘starts with’, ‘ends with’, ‘null’];
filternumericcomparisonoperators = [‘equal’, ‘not equal’, ‘less than’, ‘less than or equal’, ‘greater than’, ‘greater than or equal’, ‘null’, ‘not null’];
filterdatecomparisonoperators = [‘equal’, ‘not equal’, ‘less than’, ‘less than or equal’, ‘greater than’, ‘greater than or equal’, ‘null’, ‘not null’];
filterbooleancomparisonoperators = [‘equal’, ‘not equal’];localizationobj.filterstringcomparisonoperators = filterstringcomparisonoperators;
localizationobj.filternumericcomparisonoperators = filternumericcomparisonoperators;
localizationobj.filterdatecomparisonoperators = filterdatecomparisonoperators;
localizationobj.filterbooleancomparisonoperators = filterbooleancomparisonoperators;// apply localization.
$(“#jqxgrid”).jqxGrid(‘localizestrings’, localizationobj);
},
updatefilterconditions: function (type, defaultconditions) {
var stringcomparisonoperators = [‘EQUAL’, ‘EMPTY’, ‘NOT_EMPTY’, ‘CONTAINS’, ‘DOES_NOT_CONTAIN’, ‘STARTS_WITH’, ‘ENDS_WITH’, ‘NULL’];
var numericcomparisonoperators = [‘EQUAL’, ‘NOT_EQUAL’, ‘LESS_THAN’, ‘LESS_THAN_OR_EQUAL’, ‘GREATER_THAN’, ‘GREATER_THAN_OR_EQUAL’, ‘NULL’, ‘NOT_NULL’];
var datecomparisonoperators = [‘EQUAL’, ‘NOT_EQUAL’, ‘LESS_THAN’, ‘LESS_THAN_OR_EQUAL’, ‘GREATER_THAN’, ‘GREATER_THAN_OR_EQUAL’, ‘NULL’, ‘NOT_NULL’];
var booleancomparisonoperators = [‘EQUAL’, ‘NOT_EQUAL’];
switch (type) {
case ‘stringfilter’:
return stringcomparisonoperators;
case ‘numericfilter’:
return numericcomparisonoperators;
case ‘datefilter’:
return datecomparisonoperators;
case ‘booleanfilter’:
return booleancomparisonoperators;
}
},
updatefilterpanel: function (filtertypedropdown1, filtertypedropdown2, filteroperatordropdown, filterinputfield1, filterinputfield2, filterbutton, clearbutton,
columnfilter, filtertype, filterconditions) {
var index1 = 0;
var index2 = 0;
filtertypedropdown1.jqxDropDownList({ autoDropDownHeight: true, selectedIndex: index1 });
filtertypedropdown2.jqxDropDownList({ autoDropDownHeight: true, selectedIndex: index2 });
}
});`My requirement was showing equal as the default condition in filter, So I used updatefilterpanel. But now I have selected filter ‘Contains’ and apply filter. When I click on the applied filter and check, the condition is showing ‘Equal’ Instead of ‘Contains’ . I wanted the Equal conditions to be showed if there is no filters applied to that column. Any suggestions? Thanks in advance.
Kindest Regards
Sibeesh Venu -
AuthorPosts
You must be logged in to reply to this topic.