jQWidgets Forums
jQuery UI Widgets › Forums › Plugins › Data Adapter › data adapter and grid
Tagged: data adapter grid
This topic contains 4 replies, has 2 voices, and was last updated by atomic 11 years, 4 months ago.
-
Authordata adapter and grid Posts
-
Hi,
I am using jqx to display one chart and one grid (2 data adapters). I make some calculations on server side (php) and use data adapter to fetch data from server in json format. Then I use data adapters as sources for grid and chart. My page takes long to load so I inspected the page with firebug net tab, and it shows that I have 3 request for the data one for chart data adapter, one for grid data adapter and another one for displaying grid. Why this third request is made???
Every request takes 5-6 s, so if I could remove this one request it would be great.
Thank you very much…Hi atomic,
My suggestion is to use only 1 dataAdapter which handles the server requests. That dataAdapter would be used as a data source for two other dataAdapters used as Grid and Chart source. By doing that, you will end up with just 1 server request.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter,
Thanks for quick reply. Thing is I need 2 data adapters because data for grid and chart is different. So I think that 2 request to the server is minimum in this case, or am I wrong?
My question is why the page make third request for rendering grid?
The firs two request is made to the server (trans parameter is different)
‘http://127.0.0.1:4001/data/TRA_report_data.php?action=power_output&trans=0&_=1391413288531’ (for the chart)
‘http://127.0.0.1:4001/data/TRA_report_data.php?action=power_output&trans=1&_=1391413288591’ (for the grid)But why is this request here, it is used for the grid as well….
‘http://127.0.0.1:4001/data/TRA_report_data.php?action=power_output&trans=1&filterscount=0&groupscount=0&pagenum=0&pagesize=10&recordstartindex=0&recordendindex=18&_=1391413288626’Thanks a lot…
Hi atomic,
That actually depends on how you return the data from your server. I suppose that you can implement it in such way that you can return the 2 required data collections at once. Also, note that in case you set autoBind to true, that would not be required for the Grid’s dataAdapter.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
That is true that you can return data collection all at once, but now I implemented like this. I managed to decrease load time by putting async to true, but nothing seems to change when putting autobind to true or false…
This is one of mine dataAdapters…var myURL ='data/FED_bysectors_data.php'; var source = { url: myURL, root: 'data', datatype: 'json', cache: false, datafields: [{ name: 'year', type: 'string' }, { name: 'Industry', type: 'number' }, { name: 'Transport', type: 'number' }, { name: 'Residential', type: 'number' }, { name: 'Commercial', type: 'number' }, { name: 'Agriculture', type: 'number' }, { name: 'Fishing', type: 'number' }, { name: 'Non_energy_use', type: 'number' }, { name: 'Other', type: 'number' }]; }; var dataAdapter = new $.jqx.dataAdapter(source);
and what is strange I can remove whole data fields part ad the chart will still be rendered. How is that???
-
AuthorPosts
You must be logged in to reply to this topic.