View Full Version : Multiple Stores Using the Same Model

15 Feb 2012, 10:37 AM
I have multiple stores using the same model. This is because one of them contains search results, and another contains a regular record set.

You can click on a search result and it populates a form just like the regular items do. However, because the store isn't the same, a save() is only possible if I lookup the correct store.

I'd rather not use two stores for this use case. Does it seem strange that I'm doing this?

15 Feb 2012, 10:52 AM
So you have a record that you got from one store and did a setRecord on a form and when you go to save the model it doesn't know which store it came from?

15 Feb 2012, 10:55 AM
Sort of. I'm passing the record from a view, finding its storeId and looking up the store based on that. Than I'm saving the correct store.

Problem is, I don't feel like I should be using two different stores that use the same model.

15 Feb 2012, 2:02 PM
As of Ext 4.1 this should be valid and work (in theory) since Model instances (aka Records) can be bound to multiple stores.