javascript - why label in view get data from controller is null -


i have write code in controller launch function .get data store,and use ext.each string in records,and use setdata pass string type data make label display . if write static string work, dont work when pass string records + describe string.

code in controller launch funtion

storeid.load({         callback: function(records, operation, success){             ext.each(records, function(record) {                 console.log(record.get('data'));                 console.log(record.get('earn'));                                     var data = record.get('data');                                         var string = '{data:\'' + record.get('data') + '\',earn:\'' + record.get('earn') + '\'}';                 console.log(string);             //ext.getcmp('datalabel').setdata({data: '10000',earn: '10000'});----work             ext.getcmp('datalabel').setdata(string);-----not work display null             });         }     }); 

code in view

                        xtype: 'label',                         id: 'datalabel',                         flex: 1,                         store: 'datainterests',                         tpl: 'money:{data},interests:{earn}', 

this code works prove setdata() apply object type argument instead of string.

ext.getcmp('datalabel').setdata({data: '10000',earn: '10000'}); 

you may try :

ext.getcmp('datalabel').setdata({     data: record.get('data'),     earn: record.get('earn') }); 

or

ext.getcmp('datalabel').setdata(record.raw); 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -