Results 1 to 3 of 3

Thread: Touche 2.1.1 and idProperty

    Looks like we cannot reproduce this. Please provide another test case to reproduce this issue.
  1. #1
    Touch Premium Member
    Join Date
    Jan 2008
    Location
    Quebec, Canada
    Posts
    136
    Vote Rating
    5
      0  

    Exclamation Touche 2.1.1 and idProperty

    Don't know if it is a bug or a misuse, but I don't understand what is going on here.
    I set the idProperty of a model like this:

    Code:
    Ext.define('State', {
        extend: 'Ext.data.Model',
        config: {
            idProperty: 'key',
            fields: [
                {name: 'key', type: 'auto'},
                {name: 'value', type: 'auto'}
            ]
        }
    });
    Then, when I create a Model with data like : {key: 'test', value: '123'}. The resulting id of the record is a generated one ! What is the point of idProperty if an id is always generated ??
    Then putting this in a Store and using getById does not work.
    What's wrong ?
    Is this a bug ?

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    It's working for me:

    Code:
    var rec = new State({
        key   : 1234,
        value : 'bar'
    });
    
    console.log(rec.getId()); //1234
    
    var store = new Ext.data.Store({
        model : 'State',
        data  : [
            {
                key   : 'abcd',
                value : 'foo'
            }
        ]
    });
    
    console.log(store.getById('abcd')); //finds the record
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Touch Premium Member
    Join Date
    Jan 2008
    Location
    Quebec, Canada
    Posts
    136
    Vote Rating
    5
      0  

    Default

    Yes. It was a confusion on my side combined with an error. Because in the debugger, the id property of model is "ext-record-XX". So since it was not working I thought that was the problem ...

Posting Permissions

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