javascript - ExtJS: store.load() doesn't load data -
i'm faced problem in extjs 4.2, store.load() method doesn't load data server, retrieve json. js/itfx/resources/genres.json file:
[{"name":"action & adventure","code":"action-adventure-00"},{"name":"african","code":"african-00"},{"name":"anime","code":"anime-00"},{"name":"bollywood","code":"bollywood-00"},{"name":"classics","code":"classics-00"},{"name":"comedy","code":"comedy-00"},{"name":"concert films","code":"concert-films-00"},{"name":"documentary","code":"documentary-00"},{"name":"drama","code":"drama-00"},{"name":"foreign","code":"foreign-00"},{"name":"holiday","code":"holiday-00"},{"name":"horror","code":"horror-00"},{"name":"independent","code":"independent-00"},{"name":"kids & family","code":"kids-family-00"},{"name":"made tv","code":"made-for-tv-00"},{"name":"middle eastern","code":"middle-eastern-00"},{"name":"music documentaries","code":"music-documentaries-00"},{"name":"music feature film","code":"music-feature-films-00"},{"name":"musicals","code":"musicals-00"},{"name":"regional indian","code":"regional-indian-00"},{"name":"romance","code":"romance-00"},{"name":"russian","code":"russian-00"},{"name":"sci-fi & fantasy","code":"scifi-fantasy-00"},{"name":"short films","code":"short-films-00"},{"name":"special interest","code":"special-interest-00"},{"name":"sports","code":"sports-00"},{"name":"thriller","code":"thriller-00"},{"name":"turkish","code":"turkish-00"},{"name":"urban","code":"urban-00"},{"name":"western","code":"western-00"}]
my model:
ext.define('itfx.model.films.info.filmgenre', { extend: 'ext.data.model', fields: [ {name: 'name', type: 'string'}, {name: 'code', type: 'string'} ] });
my store:
ext.define('itfx.store.films.info.filmgenre', { extend: 'ext.data.store', model: 'itfx.model.films.info.filmgenre', proxy: { type: 'ajax', url : 'js/itfx/resources/genres.json', reader: { type: 'json' } } });
so, after execute code abowe:
var allfilmgenresstore = ext.create('itfx.store.films.info.filmgenre'); allfilmgenresstore.load();
methods
allfilmgenresstore.getcount(); //0 allfilmgenresstore.gettotalcount(); //0
will return, store have nothing loaded i'm doing wrong? in advance
yes, assist, rout cause was, store data loaded asynchronously. code load data, should be:
allfilmgenresstore.load({ callback : function(records, options, success) { // custom logik } });
Comments
Post a Comment