Results 1 to 5 of 5

Thread: Reading/Writing multiple stores data alltogether with json

  1. #1
    Sencha User
    Join Date
    Sep 2009
    Location
    Istanbul / Turkey
    Posts
    45

    Default Reading/Writing multiple stores data alltogether with json

    I have a master/detail/detail scenario, and I am going to handle this with 3 grids.

    I have started with 3 json stores, and I would like the ability to load all 3 of them at once. This should be possible, in the end we should be able to return
    { success: true, data1:[{...},{...}], data2:[{...},{...},{...}],data3:[{...},{...}] }
    because we can specify the root properties in the store.

    My question is can ExtJS stores be configured to handle multiple types of data, or do we need to handle this on our own, in any case if you can provide me some samples I would be glad.
    This scenario also applies to when writing data back to the server, instead of 3 different posts for each store, I would like to be able to send the updates at once.

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    Loading:
    Code:
    store1.load({
      callback: function(){
        store2.loadData(store1.reader.jsonData);
        store3.loadData(store1.reader.jsonData);
      }
    });
    Writing:
    Write beforesave handlers on all stores that remember that data, but return false.
    After you have all data you can initiate transactions for the data yourself.

  3. #3
    Sencha User
    Join Date
    Sep 2009
    Location
    Istanbul / Turkey
    Posts
    45

    Default

    any chance of getting the AJAX json strings to be sent.
    beforesave event only gives me the data changes, I could not find an easy of converting them to json.

  4. #4
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    You could create dummy directFns to handle the create, update and delete actions that only collect the data.

    But it doesn't really matter which method you use, you're going to have to write quite a lot of code to do this, because the framework wasn't designed for this.

  5. #5
    Sencha User
    Join Date
    Sep 2009
    Location
    Istanbul / Turkey
    Posts
    45

    Default

    I used beforesave handlers, its all good now

Similar Threads

  1. Single JSON to multiple stores
    By deanoj in forum Ext 2.x: Help & Discussion
    Replies: 9
    Last Post: 5 Mar 2009, 7:48 PM
  2. Multiple stores for the same data.
    By zoodia in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 19 Jan 2009, 8:52 AM
  3. Convert single JSON file to Multiple Stores
    By orangehairedboy in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 1 Feb 2008, 11:02 AM
  4. Solved by writing a post: GridPanel not displaying JSON data
    By Ldom in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 22 Jan 2008, 7:46 AM
  5. question on Reading & Writing from JS
    By Mohammed in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 5 Apr 2007, 6:12 PM

Tags for this Thread

Posting Permissions

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