PDA

View Full Version : read property from JSON format



Krishna_tgkk
6 May 2010, 1:05 PM
Hi

I have a servlet which returns following JSON format
({ "totalCount" : "2000", "records" : [{"id":"241","firstname":"Venus","lastname":"Acevedo","middle":"Iona","title":"Dr.","maritalstatus":"Divorced","street":"975-4076 Accumsan Rd.","city":"San Fernando","state":"AK","department":"Customer Service","datehired":"2002-10-15 17:40:58","dob":"1944-01-03 00:22:20","zip":"62848","salary":"0","fullName":"Acevedo, Venus"},{"id":"883","firstname":"Stone","lastname":"Acevedo","middle":"Murphy","title":"","maritalstatus":"Single","street":"Ap #296-1609 Nascetur St.","city":"Clarksville","state":"DE","department":"Payroll","datehired":"2005-12-27 16:18:25","dob":"1965-11-09 02:18:13","zip":"80668","salary":"0","fullName":"Acevedo, Stone"}]})

My requirement is to use totalCount property in my javascript file and display a message to user. can anyone tell me how to do it. I am using records property for displaying the grid.

Hope I am clear

Thanks
Krishna

Ytorres
6 May 2010, 1:51 PM
Hi,

You should specify witch property handle the totalCount number into your reader.

For example, for JsonReader, read the doc here :
http://www.extjs.com/deploy/dev/docs/?class=Ext.data.JsonReader
and more particulary, the totalProperty item.

Best,
Yannick