PDA

View Full Version : Same records fetch problem



arul_css
14 Mar 2013, 3:25 AM
Hi

I have some records having same ids in data base , I am able to get those data as expected in JSON response , but in the grid it shows single record only.

{id:'company',header: "Id", width: 10, sortable: false, dataIndex: 'id'}

Note : If records having different ids it works fine

Please help

Farish
14 Mar 2013, 5:41 AM
the id should be a unique value for each record. it doesnt necessarily have to be an integer but any field which can be used to distinguish the records. if your id fields are not unique, you can add another field with counter values (which would be unique then) as a workaround although i wouldnt recommend it.

arul_css
14 Mar 2013, 6:23 AM
Hi Farish

I have removed id from this code, even then it is just fetching single record to the grid like before( but 2 records in json response)

{id:'company',header: "Id", width: 10, sortable: false, dataIndex: 'id'}

Note : id:company is of no use for my requirement

Farish
14 Mar 2013, 6:28 AM
the problem was not the id of the grid column. its the id field in your records. that must be unique. you said that your records do not have a unique id and when they do, then it works fine. you need to have one field which is unique to distinguish the records.

svignesh
14 Mar 2013, 9:39 AM
Store will look for unique records by using its "internalId" property and I believe the store by default will map it's "internalId" to 'id' property . Try changing the fieldName "id" to some other value and check. it might work.

arul_css
14 Mar 2013, 9:45 PM
Hi all

After changing id value which is available duplicate value it is working

Thanks