jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Load data from URL is not working in Mobile Grid Demo
Tagged: grid data binding
This topic contains 3 replies, has 2 voices, and was last updated by Peter Stoev 9 years, 11 months ago.
-
Author
-
Hi I am new to Android. I am developing android application using Jqxgrid. The Sample you provided is working fine where as if i use url instead of localdata then the data is not loaded in the grid.
var theme = prepareSimulator("grid"); var url=window.JSInterface.getProducts(); alert("url value=="+url) //var data=[["Alfreds Futterkiste", "Maria Anders", "Sales Representative", "Obere Str. 57", "Berlin", "Germany"]]; var source = { url: url, //localdata: jsondata, datatype: "array", datafields: [ { name: 'CompanyName', type: 'string', map: '0' }, { name: 'ContactName', type: 'string', map: '1' }, { name: 'ContactTitle', type: 'string', map: '2' }, { name: 'Address', type: 'string', map: '3' }, { name: 'City', type: 'string', map: '4' }, { name: 'Country', type: 'string', map: '5' } ] }; var dataAdapter = new $.jqx.dataAdapter(source); $("#grid").jqxGrid( { width: '100%', height: '100%', source: dataAdapter, theme: theme, columnsheight: 40, columnsmenuwidth: 40, rowsheight: 34, columns: [ { text: 'CompanyName', dataField: 'CompanyName', width: '40%' }, { text: 'ContactName', dataField: 'ContactName', width: '20%', align: 'right', cellsalign: 'right' }, { text: 'ContactTitle', dataField: 'ContactTitle', width: '20%', cellsalign: 'right', align: 'right', cellsformat: 'c2' }, { text: 'Address', dataField: 'Address', cellsalign: 'right', align: 'right', cellsformat: 'c2' } ] }); initSimulator("grid"); });
Java Code:
public String getProducts() { String ret=""; ret="[[\"Alfreds Futterkiste\", \"Maria Anders\", \"Sales Representative\", \"Obere Str. 57\", \"Berlin\", \"Germany\"]]"; return ret; }
The alert Message shows the data successfully whereas the grid shows “No data to display”. Please suggest me.
Hi selva,
If it’s not working then your URL is probably wrong or your source object’s initialization is wrong. To learn how to bind jqxGrid I suggest you to look at the Help topics and Examples on our website.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
The URL is correct. The alert Message in the Javascript shows the data correctly. Also the Initialization is done by the way you given in your example.
The alert message shown as below:url value==[[“Alfreds Futterkiste”,”Maria Anders”,”Sales Representative”,”Obere Str. 57″,”Berlin”,”Germany”]]
Please see my code and suggest me if there is any error.
Hi selva,
I already wrote you what you should do.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.