Results 1 to 3 of 3

Thread: Multiple stores, single data

  1. #1
    Sencha User
    Join Date
    Dec 2010
    Posts
    79

    Default Multiple stores, single data

    In complex applications, one usually ends up with multiple stores referring to the same data. Let's say you have a Product to Orders relation and a ProductStore as well as an OrderStore.

    A user views an order from the OrderStore. The user also sees the Product, as it's a relation to the Order. Now he changes the product's name and submits it to the server. Now the Order will not reflect the product name change unless he/she reloads the order.

    The logical approach would be that ExtJS holds only one instance of a model with a specific ID, so that no two IDs can have different states.

    I'm pretty certain that stock ExtJS can't do that, but have you solved that issue in any of your projects?

    thanks
    Felicitus

  2. #2
    Ext JS Premium Member Greendrake's Avatar
    Join Date
    Jul 2008
    Location
    New Zealand
    Posts
    200
    Answers
    8

    Default

    Quote Originally Posted by Felicitus View Post
    I'm pretty certain that stock ExtJS can't do that, but have you solved that issue in any of your projects?
    ChainedStores are supposed to alleviate the issue, but at the moment they seem to be playground toys only. You can't even use paging on them not even saying of mixing buffered master stores with non buffered chain stores or vice versa.

    Previously I addressed the issue by creating sort of "event web" inside my ExtJS apps. With your example, this would mean subscribing the OrderStore to update events happening in ProductStore. The event handler would check if the products that have been updated are referenced within the OrderStore and update either the product references only, or update/reload the whole relevant order, or simply reload the whole OrderStore depending on the level of your desired granularity / meticulousness and whether you worry of extra not necessarily necessary AJAX calls / loading masks happening in your app now and again.

    But now look, your product master data is on the server, not in the ProductStore within your browser window. You want the order view to be refreshed not because you've updated a product record in your ProductStore, but actually because the product has been updated on the server. It may have been updated from another browser window as well (whether by the same or another user), or updated on the server by some integrations etc. you would still want your order view to reflect the change.

    Therefore, I think that ultimately the issue is to be addressed by utilising Websockets or Server Sent Events: your OrderStore would simply receive an update from the server whenever there is one whether the change originated from your browser window on not.
    Know the actual implications of using GPL-licensed client-side JavaScript.

  3. #3
    Sencha User
    Join Date
    Dec 2010
    Posts
    79

    Default

    I just learned that there's Session which does seem to do what I want. I need to try this out, but it looks promising.

Similar Threads

  1. Synchronising multiple data stores with a single request
    By jay252 in forum Sencha Touch 2.x: Q&A
    Replies: 2
    Last Post: 8 Nov 2012, 7:12 AM
  2. Loading data from multiple stores into a single chart
    By sarabjeetd in forum Community Discussion
    Replies: 1
    Last Post: 2 Mar 2012, 9:19 AM
  3. Manipulate multiple Data Stores by a Single Ajax Call
    By pathum in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 24 Feb 2012, 10:38 AM
  4. Single XML, multiple stores?
    By jimmifett in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 23 Aug 2010, 8:51 AM
  5. Single JSON to multiple stores
    By deanoj in forum Ext 2.x: Help & Discussion
    Replies: 9
    Last Post: 5 Mar 2009, 7:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •