jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Xml Data wont load in grid
Tagged: grid, grid xml, xml datagrid
This topic contains 2 replies, has 2 voices, and was last updated by Peter Stoev 13 years, 2 months ago.
-
Author
-
Hi I just started testing the grid widgets , but i cant get any of the xml data to be loaded into the gird, it loads without data. below is the code am using
var theme = getTheme();
var repurl = “../data/reps.xml”;// Preparing Data
var repSource =
{
datatype: “xml”,
datafields:
[
{ name: ‘RepName’ },
{ name: ‘RepCode’ },
{ name: ‘Branch’ },
{ name: ‘CRDNumber’ },
{ name: ‘NumberofAccounts’ },
{ name: ‘NumberofTrades’ },
{ name: ‘NumberofCancels’ },
{ name: ‘AverageCommission’ },
{ name: ‘AveragePH’ },
{ name: ‘AverageCOA’ },
{ name: ‘AverageTurnover’ }
],
root: “Reps”,
record: “Rep”,
id: “RepID”,
url: repurl
};var repDataAdapter = new $.jqx.dataAdapter(repSource, {
downloadComplete: function (data, status, xhr) { },
loadComplete: function (data) {},
loadError: function (xhr, status, error) { }
});// Initialize Grid
$(“#repGrid”).jqxGrid(
{
width: 760,
source: repDataAdapter,
theme: theme,
//pageable: true,
//autoheight: true,
//sortable: true,
//altrows: true,
//selectionmode: ‘singlecell’,
//enabletooltips: true,
columnsresize: true,
columns:
[
{ text: ‘Rep Name’, datafield: ‘RepName’, width: 100 },
{ text: ‘Rep Code’, datafield: ‘RepCode’, width: 100 },
{ text: ‘Branch’, datafield: ‘Branch’, width: 100 },
{ text: ‘CRD Number’, datafield: ‘CRDNumber’, width: 100, cellsalign: ‘right’ },
{ text: ‘No. of Accounts’, datafield: ‘NumberofAccounts’, width: 120, cellsalign: ‘right’},
{ text: ‘No. of Trades’, datafield: ‘NumberofTrades’, width: 110, cellsalign: ‘right’},
{ text: ‘No. of Cancels’, datafield: ‘NumberofCancels’, width: 120, cellsalign: ‘right’},
{ text: ‘Avg Comm.’, datafield: ‘AverageCommission’, width: 100, cellsalign: ‘right’},
{ text: ‘Avg P & H’, datafield: ‘AveragePH’, width: 100, cellsalign: ‘right’},
{ text: ‘Avg COA’, datafield: ‘AverageCOA’, width: 100, cellsalign: ‘right’},
{ text: ‘Avg Turnover’, datafield: ‘AverageTurnover’, width: 120, cellsalign: ‘right’},
]
});Hi sadranyi,
Could you post a valid .xml file? I also suggest you to take a look at this help topic which shows how to load XML into the Grid.
Looking forward to your reply.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi sadranyi,
I prepared online demo from your xml and using the code I posted in my last post. Here’s the demo link: Online Demo
Download Project: bindtoxml.zip.
I suppose that the url to your xml data was incorrect.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.