Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: DataReader realize usage

  1. #1
    Sencha Premium User mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    3,153

    Default DataReader realize usage

    I'm trying to realize a record created with a dummy id, with data returned from the server. But after calling realize on the DataReader I can't find the record by calling getById on the store using the new Id...

    Code:
    // DWR create callback
    callback :function(data, args) {
         var newBookingObj = Ext.decode(data);
         g.bookingStore.reader.realize([args.booking], [newBookingObj]);
         // g.bookingStore.getById(newBookingObj.Id) === null
    },
    arg: {
        booking : r
    }
    Any hints?

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    The id property of a Record is lowercase.

  3. #3
    Sencha Premium User mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    3,153

    Default

    I know, but that's not relevant here. My reader is configured with idProperty: 'Id'. and the server sends back a blob with Id property set properly...

    newBookingObj is the decoded blob and newBookingObj.Id is a valid Id

    Examining the record shows it has updated its id to my newBookingObj.Id which is good. I feel like the store is not aware of this change/realization...

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    I'm not really familiar with that area. All I can suggest is step into the realize call and see what happens to the Record.

  5. #5
    Sencha Premium User mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    3,153

    Default

    WTF??? Something I never thought I'd see in an Animal post.

    I'm not really familiar with that area.

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

    Default

    If the records are part of a store you also need to reMap them.

  7. #7

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

    Default

    Code:
    g.bookingStore.reader.realize(args.booking, newBookingObj);
    g.bookingStore.reMap(args.booking);
    ps. realize and reMap support both arrays or single objects.

  9. #9
    Sencha Premium User mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    3,153

    Default

    Thanks Condor. I searched for reMap but didn't find anything anywhere in the docs. Is it a private method or just not documented? Would it make sense for the record to notify its store about the realization to be able to use store.getById right after a realize?

  10. #10
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    That method is not documented. Anyone want to volunteer some documentation for it? I couldn't describe its purpose properly - I'm not familiar enough with it.

Page 1 of 2 12 LastLast

Posting Permissions

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