jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Grid update clean's the filterrow values.
This topic contains 1 reply, has 2 voices, and was last updated by Peter Stoev 12 years, 1 month ago.
-
Author
-
Hi, I’am having a problem with the update of the grid data and the filterrow. If the grid update is happening in the same time as the user is changing the filterrow textbox or is checking some items in the checkedlist the grid “clean’s” the filter. How can i avoid this behavior?
In the following example, the grid data is updating in a interval of 5 seconds, try to change the filterrow’s value to see the behavior.
$(document).ready(function () {
var theme = getTheme();
var url = “../sampledata/products.xml”;
// prepare the data
var data = generatedata(30);
var source =
{
localdata: data,
datafields:
[
{ name: ‘name’, type: ‘string’ },
{ name: ‘productname’, type: ‘string’ },
{ name: ‘quantity’, type: ‘number’ }
],
datatype: “array”
};var dataAdapter = new $.jqx.dataAdapter(source, {
downloadComplete: function (data, status, xhr) { },
loadComplete: function (data) { },
loadError: function (xhr, status, error) { }
});
// initialize jqxGrid
$(“#jqxgrid”).jqxGrid(
{
width: 670,
filterable: true,
showfilterrow:true,
theme: theme,
pageable: true,
autoheight: true,
sortable: true,
altrows: true,
columns: [
{ text: ‘Name’, datafield: ‘name’, width: 250 },
{ text: ‘Product name’, datafield: ‘productname’, width: 150, filtertype: ‘checkedlist’ },
{ text: ‘Units In Stock’, datafield: ‘quantity’, cellsalign: ‘right’, width: 100 },]
});function updateData()
{
var data = generatedata(10);
var source =
{
localdata: data,
datatype: “array”
};
var dataAdapter = new $.jqx.dataAdapter(source);
$(“#jqxgrid”).jqxGrid({ source: dataAdapter });setInterval(updateData,5000);
}
updateData();
});Hi williamtourinho,
By setting the Grid’s source again, you re-render the Grid which includes the filter row, too. I suppose that you should not update the Grid while your users are entering data in the filter widgets. You can use the ‘filter’ event to trigger the changes in the filtering.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.