-
25 Feb 2008 6:56 AM #1
Ext.data.Store with composite Primary Key
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
-
25 Feb 2008 7:02 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 43
Use:
andCode:var reader = new Ext.data.JsonReader({ root: "rows", totalProperty: "results", id: 'dot_id_document_type + "-" + obj.cli_tx_document_number' }, Client);
Code:record = ds.getById(dot_id_document_type + '-' + cli_tx_document_number);
-
25 Feb 2008 7:28 AM #3
Thank you Condor, but it doesn
Thank you Condor, but it doesn
I like that solution, but is there any possibility that the JsonReader doesn
-
25 Feb 2008 7:31 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 43
It's:
getJsonAccessor creates the following function for your id:Code:id: 'dot_id_document_type + "-" + obj.cli_tx_document_number'
Code:new Function("obj", "return obj." + id)
-
25 Feb 2008 7:49 AM #5


Reply With Quote