1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    28
    Answers
    2
    Vote Rating
    3
    iron9light is on a distinguished road

      0  

    Default Answered: [2.0.1.1] Why can't I set the id field of a record when I use localstorage proxy?

    Answered: [2.0.1.1] Why can't I set the id field of a record when I use localstorage proxy?


    I wanna set the id feild by myself, and I'm sure it's unique (it's uuid string generated from server)
    Please let me do this!

    IL

  2. Fixed it
    1.
    Code:
    record.phantom = true
    before save it.

    You cannot just set
    Code:
    phantom: true
    when you define your Model.
    Or the phantom will be true when you load your record from localstorage, and this will cause some strange behaviors (try to remove one record)

    2.
    Code:
    Ext.define "Ext.ux.data.identifier.UuidIfEmpty",
      extend: "Ext.data.identifier.Uuid"
      alias: 'data.identifier.uuidifempty'
      generate: (record) ->
        id = record.getId()
        if (not id or id == 0)
          @callParent arguments
        else
          id

  3. #2
    Sencha User
    Join Date
    Aug 2011
    Posts
    28
    Answers
    2
    Vote Rating
    3
    iron9light is on a distinguished road

      1  

    Default


    Fixed it
    1.
    Code:
    record.phantom = true
    before save it.

    You cannot just set
    Code:
    phantom: true
    when you define your Model.
    Or the phantom will be true when you load your record from localstorage, and this will cause some strange behaviors (try to remove one record)

    2.
    Code:
    Ext.define "Ext.ux.data.identifier.UuidIfEmpty",
      extend: "Ext.data.identifier.Uuid"
      alias: 'data.identifier.uuidifempty'
      generate: (record) ->
        id = record.getId()
        if (not id or id == 0)
          @callParent arguments
        else
          id

  4. #3
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,142
    Answers
    131
    Vote Rating
    99
    jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice

      0  

    Default


    Awesome. I was looking into this too so I will save your answer for myself

  5. #4
    Sencha User
    Join Date
    Aug 2011
    Posts
    28
    Answers
    2
    Vote Rating
    3
    iron9light is on a distinguished road

      0  

    Default


    Quote Originally Posted by jerome76 View Post
    Awesome. I was looking into this too so I will save your answer for myself
    I always think the Store mechanism is too complex.

  6. #5
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,142
    Answers
    131
    Vote Rating
    99
    jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice

      0  

    Default


    Quote Originally Posted by iron9light View Post
    I always think the Store mechanism is too complex.
    Agreed. I've used them for over a year and I have yet to fully understand them lol.

  7. #6
    Sencha User
    Join Date
    Aug 2011
    Posts
    28
    Answers
    2
    Vote Rating
    3
    iron9light is on a distinguished road

      0  

    Default


    You cannot just set
    Code:
    phantom: true
    when you define your Model.
    Or the phantom will be true when you load your record from localstorage, and this will cause some strange behaviors (try to remove one record)

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar