PDA

View Full Version : Dynamic Model



rahul.aggarwal
29 Jun 2014, 8:35 PM
Hey guys, i need to create dynamic model for my application. The field information is retrieved in a xml file. Please tell me the way to create dynamic model. Thanks in advance.

vardhan22
30 Jun 2014, 1:27 AM
There are a lot of links which discusses this:

http://stackoverflow.com/questions/5751289/dynamic-model-with-extjs-4
http://www.sencha.com/forum/showthread.php?266047
http://www.sencha.com/forum/showthread.php?195935

Retrieving information from xml response should be your task, then go through these threads, surely you will get answer.

If you want something other than these, be specific

rahul.aggarwal
30 Jun 2014, 2:31 AM
Thanks, But still I am not able to create model dynamically. I want to know how to register a dynamically created model and store in app.js .Can you post a sample application that uses a dynamic model?

vardhan22
30 Jun 2014, 3:45 AM
The stackoverflow link i gave, discussed it properly.

But,If your model is dynamic(everything coming from server response), then why it will be declared inside app.js
Just give controllers and views in the app.js, control the action in controller. Something like use onRender, in control of controller, and get the xml there, parse it.
If you want grid, then create Fields and Column configurations in that function, which is getting called. set the grid columns, create store at that time only, with fields which you just got from parsing the response.....

Continue like this. This approach worked for several people including me