1. #1
    Ext User
    Join Date
    Aug 2010
    Posts
    23
    Vote Rating
    0
    pouli is on a distinguished road

      0  

    Default Unanswered: Write event for Ext.data.Store

    Unanswered: Write event for Ext.data.Store


    Hello to all,

    I have a Store with a write event listener like this:
    var jsWriter = new Ext.data.JsonWriter({
    returnJson: true,
    writeAllFields: true
    });

    var jsReader = new Ext.data.JsonReader();


    var store = new Ext.data.Store({
    baseParams:
    {
    docID: docID
    },
    storeId: 'id',
    proxy: proxy,
    reader: jsReader,
    writer: jsWriter,
    remoteSort: false,
    sortInfo: {
    field: 'sortOrder',
    direction: 'ASC'
    },
    autoSave: false,
    listeners: {
    ...

    write: {
    fn: function( store, action, result, res, rs ){
    ....
    }


    The reader is configured from the server with the metaData element in the server response.
    When I have an update action I want to read the data returned from the server.
    This works ok when I change only one record.

    For example I do rs.get('id') and it works fine.
    But my problem starts when I change more than one records.
    I see that the client sends 2 for example.
    The server returns the correct 2 records back to the client but inside the write listener the rs.length is 0 !

    Why is that ?

    Possibly this means that the client was not able to parse the answer form the server ?

    Why not undefined then ?

    Thank you in advance

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Answers
    1
    Vote Rating
    91
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    That's still something that has to be fixed.

    During processing, Ext removes each element from the 'rs' array.

    The fact that you see an empty array actually means all records were processed correctly.

  3. #3
    Ext User
    Join Date
    Aug 2010
    Posts
    23
    Vote Rating
    0
    pouli is on a distinguished road

      0  

    Default


    Hello Condor,

    I almost forgot to update this thread.
    I imagined that

    I have found a workaround in the meantime that works ok.

    I have made a private variable and I keep the getModifiedRecords() of the store.
    When the time comes that I want to process the records I access that variable instead of the rs.

    Additionally I have found that the records coming back from the server inside the server's response must have the same exact order as the client transmitted, otherwise the store changes positions of the records. This could produce several problems if you expect to find something specific always at position 1, 2, etc...


    Thank you again

Similar Threads

  1. Store write event not firing
    By bocockli in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 27 Mar 2012, 7:25 AM
  2. CRUD Store write event not firing
    By Greffin in forum Ext 3.x: Help & Discussion
    Replies: 8
    Last Post: 18 Aug 2010, 6:34 AM
  3. Replies: 0
    Last Post: 28 Jan 2010, 7:09 PM
  4. [UNKNOWN][3.0.3] FUD regarding Ext.data.Store "write" event
    By ThorstenSuckow in forum Ext 3.x: Bugs
    Replies: 2
    Last Post: 4 Jan 2010, 6:34 AM
  5. RESTful store write event
    By cripkd in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 28 Oct 2009, 12:06 AM

Thread Participants: 1

Tags for this Thread