Results 1 to 5 of 5

Thread: Ext.data.Store with composite Primary Key

  1. #1
    Ext User
    Join Date
    Dec 2007
    Posts
    4
    Vote Rating
    0
      0  

    Question Ext.data.Store with composite Primary Key

    Two questions.

    How could I define a JsonReader with a composite primary key:

    The primary key is composite by two fields:

    • dot_id_document_type
    • cli_tx_document_number


    The JsonReader definition:

    var reader = new Ext.data.JsonReader({
    root : "rows",
    totalProperty : "results",
    id: ???
    }, Client);

    2. How could I rescue the row from the grid?

    record = ds.getById(The component espects an String here, and so?);

    Thank you, but I

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    118
      0  

    Default

    Use:

    Code:
    var reader = new Ext.data.JsonReader({
      root: "rows",
      totalProperty: "results",
      id: 'dot_id_document_type + "-" + obj.cli_tx_document_number'
    }, Client);
    and

    Code:
    record = ds.getById(dot_id_document_type + '-' + cli_tx_document_number);

  3. #3
    Ext User
    Join Date
    Dec 2007
    Posts
    4
    Vote Rating
    0
      0  

    Question Thank you Condor, but it doesn

    I like that solution, but is there any possibility that the JsonReader doesn

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    118
      0  

    Default

    It's:
    Code:
    id: 'dot_id_document_type + "-" + obj.cli_tx_document_number'
    getJsonAccessor creates the following function for your id:
    Code:
    new Function("obj", "return obj." + id)

  5. #5
    Ext User
    Join Date
    Dec 2007
    Posts
    4
    Vote Rating
    0
      0  

    Default It Works!!!

    Thank you very much!!

Posting Permissions

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