Results 1 to 2 of 2

Thread: getById fails after adding record to store

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    4
    Vote Rating
    0
      0  

    Default getById fails after adding record to store

    When we add a record to a store the value in the keys array for the store does not have a proper id. For example, when the store is first loaded the keys are this:

    keys: Array (4)
    0: "283"
    1: "277"
    2: "278"

    When we add a record using add() and sync() with a rest store the id is returned from the database insert to the record in the store, but the keys array now looks like this:

    keys: Array (4)
    0: "283"
    1: "277"
    2: "278"
    3: "ext-record-72"

    The record in the data array correctly has the id from the database insert, but it is not correctly set in the keys array. Since getById() uses the keys array it is unable to find the newly added record.

    Note that we had to modify sencha-touch.js by replacing:

    data.replace(record);

    ...with this:

    if (action == 'create') {
    data.replace(data.getKey(this.getNewRecords()[0]), record);
    }
    else {
    data.replace(record);
    }

    ...to get the id from the database insert correctly added to the store.

  2. #2
    Touch Premium Member lylepratt's Avatar
    Join Date
    Dec 2010
    Location
    Austin, Texas
    Posts
    159
    Vote Rating
    0
      0  

    Default

    I can verify that this is indeed a bug.

Posting Permissions

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