PDA

View Full Version : Is it possible to get the data for gird without knowledge of model ?



samir_ware
11 Aug 2012, 1:57 AM
Hello all
I am trying to construct a grid dynamically. I am wondering if it is possible to render the grid without knowledge of model. I am currently using the JSON data for the grid.
At present I am fetching data from the server and creating model on the fly based on the data that I received from the server and then attaching data to the grid. Though I want my grid to send across the request by itself and get the data from the server. Is there any way to achieve this ? In a nutshell is it possible to get the data for gird without knowledge of model in advance ?
Thanks
Samir

kaiden.vo
11 Aug 2012, 6:14 AM
Yes - It is possible.

First, the backend needs to send metadata along with the data. The proxy set the model with the new metadata and then fire metachanged event. If you need to customize your fields, you can override onMetachange() inside the reader, in which you would compose data model fields and set them to the model using model.setFields().

Second, the grid would listen to the store metachanged event and invoke a reconfigure() with newly composed columns to accommodate the new data fields.

Cheers,

luisparada
11 Aug 2012, 8:22 AM
You should mark the last answer as "Best Answer" and close this post. ;)

samir_ware
12 Aug 2012, 6:36 PM
Thanks ...that helps.....Thank you once again for the help

Ricardo Luiz Pinto
25 Sep 2012, 5:37 PM
Dear,
do you can post an example in MVC structure?