Results 1 to 9 of 9

Thread: [FIXED] Unable to set "idProperty" of Model

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1

    Exclamation [FIXED] Unable to set "idProperty" of Model

    Code:
    Ext.regModel('book', {
    	idProperty: 'bookId',
    	fields: [
    		{name: 'bookId', type: 'string', defaultValue: 'grmbl..'},
    		{name: 'bookTitle', type: 'string'},
    	],
    });
    Doesn't seem to give the wanted result... I expect when setting idProperty that my new instances id becomes the value of bookId. But it's stays the default: "ext-record-1", "ext-record-2", "ext-record-3", etc etc

  2. #2
    Sencha User
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939

    Default

    The .id property is an internal ID we use to track model instances that have never been saved and therefore do not have a bookId yet. In the next beta I'll change this to something more meaningful like .internalId to avoid this confusion. For now you can use the API as documented - getId() and setId(), which do honor the idProperty.

  3. #3

    Default

    [EDIT] never mind, after reading your reply for the second time i got it! [/EDIT]

  4. #4

    Default

    ok... back again

    When trying to do the next thing:

    Code:
    datastoreBooks.getById(bookId)
    It gives me undefined. Probably because this searches for that internal ID. So it's a bit confusing how it all works with that ID.

  5. #5
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243

    Default

    idProperty in Ext JS makes it so that the internalId is mapped to that property. That way you can use getById etc using your own id's instead of generated ones. Expect this to be the same for Sencha Touch in the next release (due in a couple hours).

  6. #6
    Sencha User
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939

    Default

    As of the next release, Store#getById will honor the configured idProperty of the model, not the private internal ID we assign to every model instance.

  7. #7
    Touch Premium Member
    Join Date
    Jun 2010
    Posts
    324

    Default

    What is the trick to getting this to work? I set the idProperty of my model to ID. Then I try to use store.getById(ID) and it always returns null. What else is needed for this to work.

  8. #8
    Sencha User
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939

    Default

    Quote Originally Posted by profunctional View Post
    What is the trick to getting this to work? I set the idProperty of my model to ID. Then I try to use store.getById(ID) and it always returns null. What else is needed for this to work.
    That should be all you need. If you can provide a small but complete code sample showing the problem I'll be happy to help

  9. #9
    Sencha User
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939

    Default

    Quote Originally Posted by profunctional View Post
    What is the trick to getting this to work? I set the idProperty of my model to ID. Then I try to use store.getById(ID) and it always returns null. What else is needed for this to work.
    That should be all you need. If you can provide a small but complete code sample showing the problem I'll be happy to help

Similar Threads

  1. Solved: Unable to utilise rowselect from selection model in Editor Grid
    By sleepyuk in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 27 Apr 2010, 4:31 AM
  2. Unable to set style using TreeGridCellRenderer
    By mathaj77 in forum Ext GWT: Discussion
    Replies: 1
    Last Post: 19 Aug 2009, 1:41 AM
  3. Unable to set height/width of textarea
    By jorrill in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 28 Mar 2009, 8:13 AM
  4. Unable to set baseCls
    By MattMyob in forum Sencha Ext JS Q&A
    Replies: 1
    Last Post: 3 Oct 2008, 6:18 AM
  5. Unable to set background on panel
    By cdasher in forum Ext GWT: Help & Discussion (1.x)
    Replies: 4
    Last Post: 28 Jun 2008, 2:08 AM

Posting Permissions

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