PDA

View Full Version : Loading data store from multiple sources for tabbed form



rbraddy
17 Oct 2009, 9:45 AM
Hi,

I have a tabbed form that I need to load (and submit) data elements that reside in multiple tables on the server side. Normally, loading and submitting form data is very straightforward when a single data store maps directly to a form.

Is there a convenient way to load a single data store from multiple data sources on the server?

In my case, I need to load a single tabbed form up with data from 3 sources:

- Project settings
- Schedule settings
- Goal settings

I'm using JsonStore with built-in HTTP proxy. I'm pretty sure that once I have the store loaded up and the form gets submitted, I can easily handle the server side.

Thanks in advance for any assistance.

Rick

tubamanu
17 Oct 2009, 10:03 AM
hi,

i ve done something similar some weeks ago. if i understood right, u need to load data from multiple tables on serverside, and add the resultset to your extjs form elements ?

in my application i did not use a jsonstore to add data to the form elements.....i used an ajax request to fetch my data from serverside, and then added them to my elements.....

rbraddy
17 Oct 2009, 10:18 AM
That's correct. I have three different Rails controllers on the server side that I need to request data from and map to various form controls in my form.

On further thought, I'm thinking I may just be able to send a 3-part JSON response to a single client-side request... but would be great to be able to load a client-side JSON store by querying my existing 3 server-side controllers.

tubamanu
17 Oct 2009, 10:27 AM
yes, maybe u can load one url using your json store on clientside, but manage on rails side to load data from multiple tables.
then u can send all data to client maybe using some kind of this:



$this->renderText('({"table1":"'.$resultTable1.'","table2":'.$resultTable2.'})');

rbraddy
17 Oct 2009, 12:03 PM
Yeah, that's probably what I'll end up doing, since there's not a clear way to do it from the client side

I was hoping "JsonStore.load()" might do it, but it's unclear whether there's a way to aggregate multiple load() requests in ExtJS.

Thanks

Rick

tubamanu
17 Oct 2009, 12:30 PM
i think that multiple request are no good solution for your problem. i used symfony framework for my last project, it nearly similar to RoR, there i used my model classes to fetch the data from my table, not the controller. so u can write your model classes to fetch your data, and add your resultset from all of your model classes to your response....

rbraddy
17 Oct 2009, 1:05 PM
Thanks. I understand how to do the aggregation on the server side in Rails - no biggie... just combine several hashes together and shoot them across to the client via Json.

What I was hoping to find out was if there's a way to do this aggregation via ExtJS on the client side (to have options and know what's possible).

Thanks

Rick

tubamanu
17 Oct 2009, 1:27 PM
ah okay :)
but i don' know if it is possible in ext....