jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Initial filter not setting condition
This topic contains 3 replies, has 2 voices, and was last updated by nikitaso 9 years, 8 months ago.
-
Author
-
If you run this code in your example, it doesnt set correct filter condition, just sets to first in the list. Or am I doing something wrong?
`$(document).ready(function () {
var data = generatedata(500);
var source =
{
localdata: data,
datafields:
[
{ name: ‘firstname’, type: ‘string’ },
{ name: ‘lastname’, type: ‘string’ },
{ name: ‘productname’, type: ‘string’ },
{ name: ‘date’, type: ‘date’ },
{ name: ‘quantity’, type: ‘number’ },
{ name: ‘price’, type: ‘number’ }
],
datatype: “array”
};
var adapter = new $.jqx.dataAdapter(source);
var quantityColumnFilter = function () {
var filtergroup = new $.jqx.filter();
var filter_or_operator = 1;
var filtervalue = 7;
var filtercondition = ‘greater_than’;
var filter = filtergroup.createfilter(‘numericfilter’, filtervalue, filtercondition);
filtergroup.addfilter(filter_or_operator, filter);
return filtergroup;
}();
$(“#jqxgrid”).jqxGrid(
{
width: 850,
source: adapter,
filterable: true,
showfilterrow:true,
sortable: true,
columns: [
{
text: ‘First Name’, datafield: ‘firstname’,
width: 160
},
{ text: ‘Last Name’, datafield: ‘lastname’, width: 160 },
{ text: ‘Product’, datafield: ‘productname’, width: 170 },
{ text: ‘Order Date’, datafield: ‘date’, filtertype: ‘date’, width: 160, cellsformat: ‘dd-MMMM-yyyy’ },
{ text: ‘Quantity’, filter: quantityColumnFilter, filtertype:’number’, datafield: ‘quantity’, width: 80, cellsalign: ‘right’ },
{ text: ‘Unit Price’, datafield: ‘price’, cellsalign: ‘right’, cellsformat: ‘c2’ }
]
});
});Hi nikitaso,
It applies the correct filter to the Grid as far as I see. The only what’s not changed is the listbox’s selected item.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comYes, it does applies correct filter. But it doesnt select correct item from list box (which is a problem), so if you have initial filter set and then add another filter (filtering another column) – it will use first incorrect condition.
Is it a bug?
is it possible to change listbox item?
-
AuthorPosts
You must be logged in to reply to this topic.