javascript - How to access a value fetched from a JsonStore with ExtJS? -
in following js code, trying read json data url:
// create jsonstore var storeed = new ext.data.jsonstore({ url: './wfservlet?workd=' + workd + '&type=detail' + '&status=' + status +'&username='+username, root: 'root', fields: [{name:'error_desc'}] }); then want value field error_desc.
ext.getcmp('errormessage').setvalue(storeed.error_desc);// want read value the code above doesn't work me.
missing ?
stores don't have values. stores caches of ext.data.model instances, hold values mapped fields defined model applied store.
to accomplish you're trying do, you'll need access instance of model inside store contains record data desire, such storeed.getat(0), assuming have 1 model instance in store's cache.
if field , expect 1 instance live within store, might better not bother store @ all. either add proxy model itself, or use value returned regular ext.ajax.request. if don't plan on using value beyond particular usage, store unnecessary.
Comments
Post a Comment