jQWidgets Forums
jQuery UI Widgets › Forums › Grid › issue when re-rendering jqxGrid
This topic contains 5 replies, has 3 voices, and was last updated by Damian 8 years, 4 months ago.
-
Author
-
Hi all,
I was testing the jqxGrid and it works fine but I have an issue when re-freshing the grid.
Based on the example:
jqwidgets-ver2.2/demos/jqxgrid/grouping.htmI wrapped the javascript code in a function called RunGrid();
// $(document).ready(function () {
function RunGrid() {
var theme = ”;
var url = “../sampledata/customers.xml”;
var parentsLength = $(“#jqxWidget”).parents().length;
if (parentsLength > 3) {
url = ‘demos/sampledata/customers.xml’;
}// prepare the data
var source =
{
datatype: “xml”,
datafields: [
{ name: ‘CompanyName’, map: ‘m\\:properties>d\\:CompanyName’ },
{ name: ‘ContactName’, map: ‘m\\:properties>d\\:ContactName’ },
{ name: ‘ContactTitle’, map: ‘m\\:properties>d\\:ContactTitle’ },
{ name: ‘City’, map: ‘m\\:properties>d\\:City’ },
{ name: ‘PostalCode’, map: ‘m\\:properties>d\\:PostalCode’ },
{ name: ‘Country’, map: ‘m\\:properties>d\\:Country’ }
],
root: “entry”,
record: “content”,
id: ‘m\\:properties>d\\:CustomerID’,
url: url
};// Create jqxGrid
$(“#jqxgrid”).jqxGrid(
{
width: 600,
source: source,
groupable: true,
sortable: true,
theme: theme,
columns: [
{ text: ‘Company Name’, datafield: ‘CompanyName’, width: 250 },
{ text: ‘City’, datafield: ‘City’, width: 120 },
{ text: ‘Country’, datafield: ‘Country’ }
],
groups: [‘City’]
});}
//});
So the first time I call RunGrid(); the performance is fine, but if I try a second time the image “loader.gif” doesn’t appear and the grid looks with different styles. Not properly rendered.
Any idea why re-rendering the jqGrid is being so complicated?
Thanks in advance.
Hi blinkins0n,
The correct way to refresh the Grid, if you want to refresh the data is to call the ‘updatebounddata’.
$(“#jqxgrid”).jqxGrid(‘updatebounddata’);
If you want to refresh only the UI, without the data, use the Grid’s refresh method.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
I just found the solution:
http://www.jqwidgets.com/community/topic/error-reloading-grid/
It works just fine. I think that’s the best solution since I’ll be calling Server side to call the “var source”.
Thanks anyway!
Hi all,
My problem is that, I use $(“#jqxgrid”).jqxGrid(‘updatebounddata’); in my jqxGrid but when I refresh the grids, these are marked in gray color but the grid it doesn´t filter.
Thanks anyway.
Hi all,
My problem is that, I use $(“#jqxgrid”).jqxGrid(‘updatebounddata’); in my jqxGrid but when I refresh the grids, these are marked in gray color but the grid it doesn’t filter.
Thanks anyway. -
AuthorPosts
You must be logged in to reply to this topic.