global variables - no of records in a store are not returning in extjs -
i new extjs , working on creating dynamic screen depending on no of records ext.data.store(); gettotalcount/getcount used no of records store. need store total no of records in var , return it
i trying this
function get_count() { var num; cachestore.on({ 'load':{ fn : function(store,records,options){ num = gettotalcount(); //console.info('store count = ', tsize); //console.info(' count = ', getcount()); }, scope: }, 'loadexception' : { fn : function (obj,options,response,e){ //console.info('error = ', e); }, scope : } }); // wrong logic have similar //return num; //return num }; tsize = get_count(); i null in tsize. tried getcount() instead of gettotalcount() buti getting same problem.
dont know going wrong
your logic bit poked here. can't fire function add listener store hook when store has finished loading. ( can, subtle bug down line ).
what need declare listener on store when create it, contains function wanna use number in.
cachestore =ext.create... cachestore.on('load',function(store,records,e){ //dosomestuff needs count var num= store.totalcount() //now use num in here, else create async error //or can ... my.somefunc(num); //in here, can run after store has loaded },this);
Comments
Post a Comment