PDA

View Full Version : One to Many Data Relationship with GridPanels



mj.daly
Jan 20, 2010, 3:33 PM
I have tried to combine the follwing two examples:

http://examples1.ext.net/Examples/GridPanel/DataSource_Update/SqlDataSource/
[/url]http://examples1.ext.net/Examples/GridPanel/Data_with_Details/One-to-Many/
[url="http://examples1.ext.net/Examples/GridPanel/Data_with_Details/One-to-Many/"] (http://examples1.ext.net/Examples/GridPanel/DataSource_Update/SqlDataSource/)
I can insert records in the parent table fine. But if I want to insert a record into the child table, I currently have no way of getting the store to pass the foreign key to my function in the code behind when Store.save() is called.

I am using am OnBeforeRecordInserted event on the Store to do the insert in code behind.

Vladimir
Jan 20, 2010, 3:40 PM
Hi,

1. Save to hidden fields before save calling
2. Use WriteBaseParams of the store
3. Pass params to the save function



Grid1.save({ params : { myparam : 'myvalue' } });

unico
Jun 07, 2010, 8:32 PM
Is it possible to have a sample of what you have described Vladamir? I am keenly interested in this.

EDIT: What I want to do in particular is store both the parent and the child rows in memory before persisting them to the database. After re-reading your response to the OP, I'm not sure that what you describe would accomplish that. Therefore, I will open a separate thread.


http://forums.ext.net/showthread.php?threadid=34225-4-1.aspx