jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Server side only filtering
Tagged: filter, filtering, grid, jqxgrid, server side filtering, updatebounddata
This topic contains 3 replies, has 2 voices, and was last updated by Dimitar 10 years, 2 months ago.
-
Author
-
Hi
I’m using server side filtering. I have complex server side filtering logic and for some cases server returns full dataset.
But when it heppends jqxGrid filters this data locally. How i can disable this behaviour and use server side ONLY filter.var source =
{
datatype: “json”,
datafields: [
{ name: ‘id’, type: ‘int’ },
{ name: ‘create_date’, type: ‘string’ },
{ name: ‘modify_date’, type: ‘string’ },
{ name: ‘id_ext’, type: ‘string’ },
{ name: ‘id_ext_type’, type: ‘int’ },
{ name: ‘state’, type: ‘string’ },
{ name: ‘nme’, type: ‘string’ },
{ name: ‘sent’, type: ‘string’ },
{ name: ‘answer’, type: ‘string’ },
{ name: ‘fileid’, type: ‘string’ },
],
id: ‘id’,
url: url};
var dataAdapter = new $.jqx.dataAdapter(source);
$(‘#grid’).jqxGrid(
{
width: ‘100%’,
height:’100%’,
source: dataAdapter,
columnsresize: true,selectionmode: ‘multiplecellsextended’,
enablehover:false,
altrows: true,sortable: true,
filterable:true,
showfilterrow: true,theme:’arctic’,
ready: function()
{
$(“#grid”).jqxGrid(‘selectcell’, 0, ‘Номер’);
// focus jqxgrid.
$(“#grid”).jqxGrid(‘focus’);
},columns: [
{ text: ‘Num’, datafield: ‘id’, width: 70 },
{ text: ‘Ext Num’, datafield: ‘id_ext’, width: 70 },
{ text: ‘Created’, datafield: ‘create_date’, width: 150,filtertype: ‘date’, cellsformat: ‘d’,filtertype: ‘range’ },
{ text: ‘Changed’, datafield: ‘modify_date’, width: 150,filtertype: ‘date’, cellsformat: ‘d’,filtertype: ‘range’},
{ text: ‘Type’, datafield: ‘id_ext_type’, width: 180, filtertype: ‘list’,filteritems: [‘Requests’, ‘Answers’, ‘Pendings’]},
{ text: ‘State’, datafield: ‘state’, width: 120 ,filtertype: ‘list’,filteritems: [‘New’,’Sent’]},
{ text: ‘Name’, datafield: ‘nme’, minwidth: 120 },
{ text: ‘Data’, datafield: ‘sent’, maxwidth: 50,filtertype: ‘none’ },
{ text: ‘Answer’, datafield: ‘answer’, maxwidth: 50,filtertype: ‘none’ },
{ text: ‘File’, datafield: ‘fileid’, maxwidth: 150 }]
});
$(“#grid”).on(“filter”, function (event)
{
$(“#grid”).jqxGrid(‘updatebounddata’, ‘data’);
});Hi turchaninov,
Please check out the PHP demo Grid Server Filtering, which shows this functionality correctly implemented. As you can see, updatebounddata is called in the source callback function filter.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi
According you previous post:>The adapter’s filter option should be used only when the Grid is in Virtual Mode. Otherwise, you can overwrite the built-in filtering so basically setting the adapter’s filter is wrong approach.
>Regards,
>Peter Stoevit’s not good practice to overwrite filter option on data aadpter.
But in your example this approach is usedas I mentioned in my previous posts
http://www.jqwidgets.com/community/topic/grid-keyboard-navigation-stops-working-when-showfilterrow-singlecell-used/
there are some problems in cellselection grid mode behavior and one of sugesstion was to not use this option.
I’m not using virtual mode of the gridRegards,
Turchaninov MaximHi Maxim,
In the aforementioned topic, you do not mention that your grid has (or should have) server-side filtering until the very last post. That is why this solution was not recommended by my colleague. I assure you, to implement server-side filtering, you have to synchronise with the server in the filter callback. This approach is demonstrated and is working as expected in several demos.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.