Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Ext JS Premium Member
    Join Date
    Sep 2007
    Location
    CT
    Posts
    462
    Vote Rating
    2
    ValterBorges is on a distinguished road

      0  

    Default Model idProperty

    Model idProperty


    Many times tables have natural keys instead of auto generated.

    In these scenarios is it possible to set the Model idProperty to more than one field. If not how do you concatenate two fields in the model and create a composite key???

    or is it better to not specify idProperty and let one be generated?

  2. #2
    Sencha User
    Join Date
    Apr 2011
    Location
    Spain
    Posts
    77
    Vote Rating
    1
    Fanny144 is on a distinguished road

      0  

    Default


    I have the same doubt that your. Also how you can change the name of the idProperty??
    Always must be id??or is that because extjs 4.0 still not well developed and soon it will make??

    Please, help...

  3. #3
    Sencha User
    Join Date
    May 2010
    Posts
    12
    Vote Rating
    0
    cdavide75 is on a distinguished road

      0  

    Default


    Yes, I have some problem
    in EXT JS 3.x I set IdProperty: 'namefield' and in Update the store (example grid with roweditor) 'namefiled' is use as like as ID... work
    in EXT JS 4.0 I set IdProperty but don't work. If I pass a object with key filed = 'id' work....

  4. #4
    Ext JS Premium Member
    Join Date
    Sep 2007
    Location
    CT
    Posts
    462
    Vote Rating
    2
    ValterBorges is on a distinguished road

      0  

    Thumbs up got it.

    got it.


    In the fields config object of the Model you can create a field say id that uses a convert function to concatenate two fields from the record.

    ex:

    Ext.define("My.Models.ModelA",{extend:"Ext.data.Model",
    fields:[
    {name: 'id', type:'string', convert: function(value,record) {
    return record.get('COLPK1') + record.get('COLPK2')
    }
    },
    {name: 'COLPK1', type:'string'},
    {name: 'COLPK2', type:'string'},
    {name: 'SOMEOTHERCOL', type: string'}
    ],
    idProperty: 'id'
    });

  5. #5
    Sencha User
    Join Date
    Jan 2012
    Location
    New York City
    Posts
    109
    Vote Rating
    2
    infernoz is on a distinguished road

      0  

    Default


    Doesn't this seem kind of hacky? Shouldnt there be a way of specifying multiple fields as your unique key without having to concatenate things together to create one field?

  6. #6
    Sencha User
    Join Date
    Feb 2009
    Posts
    5
    Vote Rating
    0
    yclick is on a distinguished road

      0  

    Default Warning

    Warning


    Record 0: { COLPK1: 'aa', COLPK2: 'bb' }
    Record 1: { COLPK1: 'a', COLPK2: 'abb' }

    The store will add only one row in this situation because (colpk1[0] + colpk2[0]) == (colpk1[1] + colpk2[1]).

  7. #7
    Sencha Premium Member dawesi's Avatar
    Join Date
    Mar 2007
    Location
    Melbourne, Australia (aka GMT+10)
    Posts
    1,082
    Vote Rating
    41
    dawesi has a spectacular aura about dawesi has a spectacular aura about

      0  

    Default


    You could create a custom validator to enforce the composite key.
    Teahouse Training Company
    Official Certified Sencha Trainer

    Australia / New Zealand / Singapore / Hong Kong & APAC



    SenchaWorld.com - Sencha webinars, videos, etc
    SenchaForge.org - (coming soon)
    TeahouseHQ.com - Sencha ecosystem training portal

    Code Validation : JSLint | JSONLint | JSONPLint

  8. #8
    Sencha User
    Join Date
    Oct 2007
    Posts
    1
    Vote Rating
    0
    lo230c is on a distinguished road

      0  

    Default


    You can add a dash in between and make it unique. 'aa-bb' is not the same 'a-abb'

Similar Threads

  1. Replies: 2
    Last Post: 21 Apr 2011, 2:03 AM
  2. Replies: 6
    Last Post: 19 Apr 2011, 10:28 AM
  3. [API] idProperty not documented in Model
    By mitchellsimoens in forum Sencha Touch 1.x: Bugs
    Replies: 0
    Last Post: 16 Mar 2011, 8:39 AM
  4. [FIXED] Unable to set "idProperty" of Model
    By jeroenvduffelen in forum Sencha Touch 1.x: Bugs
    Replies: 8
    Last Post: 8 Feb 2011, 1:31 PM
  5. JsonStore with idProperty
    By Gunny in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 9 Feb 2010, 1:01 AM

Thread Participants: 6