PDA

View Full Version : How can i access the meta data in jsonreader



brumby007
30 Jun 2009, 2:20 AM
First, i create json data in my server


{"CpuUsage":15,"MemUsed":697,"totalCount":67,"MemAll":894,"topics":[{"proName":"System","userName":"SYSTEM","memSzie":36864,"cpuRate":0,"proPID":4,"priority":0},{"proName":"smss.exe","userName":"SYSTEM","memSzie":53248,"cpuRate":0,"proPID":872,"priority":0},{"proName":"csrss.exe","userName":"SYSTEM","memSzie":2703360,"cpuRate":0,"proPID":912,"priority":0},{"proName":"winlogon.exe","userName":"SYSTEM","memSzie":966656,"cpuRate":0,"proPID":940,"priority":0},{"proName":"services.exe","userName":"SYSTEM","memSzie":1134592,"cpuRate":0,"proPID":984,"priority":0},{"proName":"lsass.exe","userName":"SYSTEM","memSzie":1110016,"cpuRate":0,"proPID":996,"priority":0},{"proName":"ati2evxx.exe","userName":"SYSTEM","memSzie":86016,"cpuRate":0,"proPID":1172,"priority":0},{"proName":"svchost.exe","userName":"SYSTEM","memSzie":200704,"cpuRate":0,"proPID":1192,"priority":0},{"proName":"svchost.exe","userName":"NETWORK SERVICE","memSzie":200704,"cpuRate":0,"proPID":1268,"priority":0},{"proName":"svchost.exe","userName":"SYSTEM","memSzie":200704,"cpuRate":0,"proPID":1708,"priority":0},{"proName":"ati2evxx.exe","userName":"SYSTEM","memSzie":86016,"cpuRate":0,"proPID":1932,"priority":0},{"proName":"svchost.exe","userName":"NETWORK SERVICE","memSzie":200704,"cpuRate":0,"proPID":1940,"priority":0},{"proName":"svchost.exe","userName":"LOCAL SERVICE","memSzie":200704,"cpuRate":0,"proPID":2040,"priority":0},{"proName":"spoolsv.exe","userName":"SYSTEM","memSzie":81920,"cpuRate":0,"proPID":552,"priority":0},{"proName":"scardsvr.exe","userName":"LOCAL SERVICE","memSzie":73728,"cpuRate":0,"proPID":604,"priority":0},{"proName":"explorer.exe","userName":"Administrator","memSzie":6537216,"cpuRate":0,"proPID":468,"priority":0},{"proName":"svchost.exe","userName":"LOCAL SERVICE","memSzie":200704,"cpuRate":0,"proPID":1044,"priority":0},{"proName":"jqs.exe","userName":"SYSTEM","memSzie":1441792,"cpuRate":0,"proPID":1356,"priority":0},{"proName":"FrameworkService.exe","userName":"SYSTEM","memSzie":823296,"cpuRate":0,"proPID":1392,"priority":0},{"proName":"Mcshield.exe","userName":"SYSTEM","memSzie":5218304,"cpuRate":0,"proPID":1528,"priority":0},{"proName":"naPrdMgr.exe","userName":"SYSTEM","memSzie":274432,"cpuRate":0,"proPID":1536,"priority":0},{"proName":"shstat.exe","userName":"Administrator","memSzie":552960,"cpuRate":0,"proPID":1548,"priority":0},{"proName":"UpdaterUI.exe","userName":"Administrator","memSzie":499712,"cpuRate":0,"proPID":1556,"priority":0},{"proName":"TBMon.exe","userName":"Administrator","memSzie":106496,"cpuRate":0,"proPID":1564,"priority":0},{"proName":"360tray.exe","userName":"Administrator","memSzie":2691072,"cpuRate":0,"proPID":1616,"priority":0},{"proName":"TSVNCache.exe","userName":"Administrator","memSzie":1736704,"cpuRate":0,"proPID":1628,"priority":0},{"proName":"vmware-tray.exe","userName":"Administrator","memSzie":585728,"cpuRate":0,"proPID":1780,"priority":0},{"proName":"jusched.exe","userName":"Administrator","memSzie":40960,"cpuRate":0,"proPID":1792,"priority":0},{"proName":"ctfmon.exe","userName":"Administrator","memSzie":303104,"cpuRate":0,"proPID":1868,"priority":0},{"proName":"VsTskMgr.exe","userName":"SYSTEM","memSzie":368640,"cpuRate":0,"proPID":1900,"priority":0},{"proName":"ram.exe","userName":"Administrator","memSzie":2449408,"cpuRate":0,"proPID":460,"priority":0},{"proName":"Foxmail.exe","userName":"Administrator","memSzie":5431296,"cpuRate":0,"proPID":1724,"priority":0},{"proName":"conime.exe","userName":"Administrator","memSzie":241664,"cpuRate":0,"proPID":1264,"priority":0},{"proName":"firefox.exe","userName":"Administrator","memSzie":257634304,"cpuRate":28,"proPID":1776,"priority":0},{"proName":"python.exe","userName":"Administrator","memSzie":966656,"cpuRate":0,"proPID":2116,"priority":0},{"proName":"alg.exe","userName":"LOCAL SERVICE","memSzie":151552,"cpuRate":0,"proPID":3616,"priority":0},{"proName":"Uedit32.exe","userName":"Administrator","memSzie":2338816,"cpuRate":0,"proPID":3120,"priority":0},{"proName":"iexplore.exe","userName":"Administrator","memSzie":4919296,"cpuRate":0,"proPID":3404,"priority":0},{"proName":"mdm.exe","userName":"Administrator","memSzie":286720,"cpuRate":0,"proPID":200,"priority":0},{"proName":"wnwb.exe","userName":"Administrator","memSzie":471040,"cpuRate":0,"proPID":1488,"priority":0},{"proName":"eclipse.exe","userName":"Administrator","memSzie":217088,"cpuRate":0,"proPID":4072,"priority":0},{"proName":"javaw.exe","userName":"Administrator","memSzie":63479808,"cpuRate":0,"proPID":2852,"priority":0},{"proName":"notepad.exe","userName":"Administrator","memSzie":61440,"cpuRate":0,"proPID":3448,"priority":0},{"proName":"rundll32.exe","userName":"SYSTEM","memSzie":45056,"cpuRate":0,"proPID":676,"priority":0},{"proName":"rundll32.exe","userName":"SYSTEM","memSzie":45056,"cpuRate":0,"proPID":2476,"priority":0},{"proName":"rundll32.exe","userName":"SYSTEM","memSzie":45056,"cpuRate":0,"proPID":4008,"priority":0},{"proName":"FOXITR~1.EXE","userName":"Administrator","memSzie":2621440,"cpuRate":0,"proPID":648,"priority":0},{"proName":"rundll32.exe","userName":"SYSTEM","memSzie":45056,"cpuRate":0,"proPID":1080,"priority":0},{"proName":"rundll32.exe","userName":"SYSTEM","memSzie":45056,"cpuRate":0,"proPID":1372,"priority":0},{"proName":"rundll32.exe","userName":"SYSTEM","memSzie":45056,"cpuRate":0,"proPID":1580,"priority":0},{"proName":"navicat.exe","userName":"Administrator","memSzie":126976,"cpuRate":0,"proPID":784,"priority":0},{"proName":"rundll32.exe","userName":"SYSTEM","memSzie":45056,"cpuRate":0,"proPID":1588,"priority":0},{"proName":"rundll32.exe","userName":"SYSTEM","memSzie":45056,"cpuRate":0,"proPID":3076,"priority":0},{"proName":"rundll32.exe","userName":"SYSTEM","memSzie":45056,"cpuRate":0,"proPID":2360,"priority":0},{"proName":"ConfEnv.exe","userName":"Administrator","memSzie":65536,"cpuRate":0,"proPID":2860,"priority":0},{"proName":"Uni32.exe","userName":"SYSTEM","memSzie":5357568,"cpuRate":0,"proPID":3072,"priority":0},{"proName":"mac2ip_XPE.exe","userName":"SYSTEM","memSzie":970752,"cpuRate":0,"proPID":1436,"priority":0},{"proName":"winvnc4.exe","userName":"SYSTEM","memSzie":352256,"cpuRate":0,"proPID":820,"priority":0},{"proName":"rundll32.exe","userName":"SYSTEM","memSzie":45056,"cpuRate":0,"proPID":2744,"priority":0},{"proName":"rundll32.exe","userName":"SYSTEM","memSzie":45056,"cpuRate":0,"proPID":1336,"priority":0},{"proName":"LanQQ.exe","userName":"Administrator","memSzie":655360,"cpuRate":0,"proPID":1476,"priority":0},{"proName":"rundll32.exe","userName":"SYSTEM","memSzie":45056,"cpuRate":0,"proPID":3336,"priority":0},{"proName":"rundll32.exe","userName":"SYSTEM","memSzie":45056,"cpuRate":0,"proPID":2148,"priority":0},{"proName":"rundll32.exe","userName":"SYSTEM","memSzie":45056,"cpuRate":0,"proPID":2988,"priority":0},{"proName":"javaw.exe","userName":"Administrator","memSzie":63479808,"cpuRate":0,"proPID":2856,"priority":0},{"proName":"rundll32.exe","userName":"SYSTEM","memSzie":45056,"cpuRate":0,"proPID":2980,"priority":0},{"proName":"System Idle Process","userName":"SYSTEM","memSzie":16384,"cpuRate":84,"proPID":0,"priority":0}]}


and i try to read it in js client


var process_json_reader = new Ext.data.JsonReader({totalProperty: 'totalCount',root: 'topics', CpuUsage: 'CpuUsage', memAll: 'MemAll', memUsed: 'MemUsed'},['proName', 'proPID', 'userName', 'cpuRate', 'memSzie', 'priority', 'proPath']);
var process_detail_store = new Ext.data.Store({
baseParams:{computer: computer},
proxy: new Ext.data.HttpProxy({
url: webApp+'/processList.do'
}),
reader: process_json_reader
});


but when i access json data in the pagbingbar just like this


tbar: [
{
xtype: 'panel',
html: '[CPU: ' + process_json_reader.meta.CpuUsage + ' ??: ' + process_json_reader.meta.memAll + ' ?????: ' + process_json_reader.meta.memUsed
}
]


it can't work.

brumby007
30 Jun 2009, 2:24 AM
i have read the thread:http://extjs.com/forum/showthread.php?t=70143&highlight=jsonreader+meta
but i have none idea to find out the solution .
can anyone tell more details?

Animal
30 Jun 2009, 3:30 AM
You're not using metaData.

http://extjs.com/deploy/ext-3.0-rc2/docs/?class=Ext.data.JsonReader&member=jsonData