extjs - Evaluate A function in itemTpl in a list -


i created store contains data , in view created list connected store show store data, works fine until point want call function instead of show values directly make make operations on value before rendered, how can accomplish inside itemtpl config.

view => declaration.js

ext.define('alnadeebapp.view.declaration.declaration',  {     extend: 'ext.panel.panel',      xtype: 'declaration',      requires: [         'alnadeebapp.view.declaration.declarationcontroller',         'alnadeebapp.view.declaration.declarationitems',         'alnadeebapp.view.declaration.declarationmodel'     ],      fullscreen: 'true',     getprocessingmsg: function (msg) {         return getdeclarationprocessingstatus(msg);     },     title: "البيانات",      layout: 'fit',      cls: 'declarations',      scrollable: 'y',      controller: 'declaration',      viewmodel: 'declarationmodel',      items: [         {             xtype: 'list',             reference: 'declarationlist',             scrollable: 'y',             plugins: [                 {                     xclass: 'ext.plugin.listpaging',                     autopaging: true                 }             ],             itemtpl: '<div class="declaration-item">' +              '<div class="declaration-header">' +              '{declarationno} : رقم البيان' +              '</div>' +              '<div class="right-part">' +              ' {declarationtype} : الطلب  <br>' +              'التاريخ :{createddate} | الوقت : {createddate}' +              '</div> ' +              '<span class="declaration-status">{processingstatus}</span>' +              '</div>',             listeners: {                 itemtap: 'onlistitemtap'             },             store: {                 type: 'declarationitems'             },             itemheight: '100px',             items: [                 {                     scrolldock: 'top',                     docked: 'top',                     xtype: 'fieldset',                     items: [                         {                             xtype: 'searchfield',                             name: 'query',                             placeholder: 'ابحث برقم البيان',                             inputcls: 'search-field'                         },                         {                             xtype: 'label',                             html: 'بحث متقدم',                             cls: 'advanced-search-label'                         }                     ]                 },                 {                     xtype: 'button',                     scrolldock: 'bottom',                     docked: 'bottom',                     text: 'المزيد ...',                     handler: 'onloadmoretabed'                 }]         }     ] }); 

store => declarationitems.js

/**  * created m.shebl on 10/16/2016.  */ ext.define('alnadeebapp.view.declaration.declarationitems', {     extend: 'ext.data.store',     requires: [         'alnadeebapp.view.declaration.declarationitem'     ],     alias: 'store.declarationitems',     model: 'alnadeebapp.view.declaration.declarationitem',      data: [         {"amendingbyinspector":false,"containerflag":"\u0000","createdby":"5678567820120000005","createddate":1476248246000,"declarationid":6013076,"declarationno":"5li41000030735","declarationpartydtos":[{"accountcode":"l1570","checkbox":false,"declarationupdatedpartydtolist":[],"forbatchupdate":false,"forlistupdate":false,"individualflag":false,"partyname":"منجرة كاظم","partytype":"im","selected":false},{"checkbox":false,"declarationupdatedpartydtolist":[],"forbatchupdate":false,"forlistupdate":false,"individualflag":false,"partyname":"123","partytype":"ex","selected":false}],"declarationprovisionalno":"201610128674","declarationstatus":"sub","declarationtype":"imp","harbourflag":false,"inspectionoffshore":"\u0000","onsiteinspectionapproval":"\u0000","processingstatus":"pin","reusenumber":false,"rownum_":1,"rulesresult":false,"statisticaldeclaration":"\u0000","strategicgoodsflag":"\u0000","submitteddate":1476248277000,"version":0,"wsdeclarationbillofladingdto":{"billofladingid":5994648,"bldetailspopulatedfrommanifest":false,"carrierinfodtolist":[{"carriernationality":"qa - qatar","carriernationalityarabic":"qa - قطر","carrierno":"12320151729","chassisno":"12345672015172935","drivername":"احفثسف","drivernationality":"qa - qatar","drivernationalityarabic":"qa - قطر","gatepassnumber":"2123","selectedmodelrow":0}],"countryofloading":"af - afghanistan","countryofloadingarabic":"af - أفغانستان","declarationid":6013076,"finaldestination":"qa - qatar","finaldestinationarabic":"qa - قطر","isfinaldestinationblankinmanifest":false,"isportofloadingblankinmanifest":false,"noofpackages":1,"noofpackagesuom":"bag","showpopupbtn":false}},         {"amendingbyinspector":false,"containerflag":"\u0000","createdby":"5678567820120000005","createddate":1475748148000,"declarationid":6012889,"declarationno":"5li41000030618-1","declarationpartydtos":[{"accountcode":"1003","checkbox":false,"declarationupdatedpartydtolist":[],"forbatchupdate":false,"forlistupdate":false,"individualflag":false,"partyname":"clearing agency a","partytype":"im","selected":false},{"checkbox":false,"declarationupdatedpartydtolist":[],"forbatchupdate":false,"forlistupdate":false,"individualflag":false,"partyname":"tamer-test-amendment","partytype":"ex","selected":false}],"declarationprovisionalno":"201610068487","declarationstatus":"sub","declarationtype":"imp","harbourflag":false,"inspectionoffshore":"\u0000","onsiteinspectionapproval":"\u0000","processingstatus":"pin","reusenumber":false,"rownum_":2,"rulesresult":false,"statisticaldeclaration":"\u0000","strategicgoodsflag":"\u0000","submitteddate":1475748261000,"version":0,"wsdeclarationbillofladingdto":{"billofladingid":5994492,"bldetailspopulatedfrommanifest":false,"carrierinfodtolist":[{"carriernationality":"qa - qatar","carriernationalityarabic":"qa - قطر","carrierno":"12320151729","chassisno":"12345672015172935","drivername":"احفثسف","drivernationality":"qa - qatar","drivernationalityarabic":"qa - قطر","gatepassnumber":"2123","selectedmodelrow":0}],"countryofloading":"it - italy","countryofloadingarabic":"it -  إيطاليا","declarationid":6012889,"finaldestination":"qa - qatar","finaldestinationarabic":"qa - قطر","isfinaldestinationblankinmanifest":false,"isportofloadingblankinmanifest":false,"noofpackages":1,"noofpackagesuom":"kg","portofloading":"itqcm - como","portofloadingarabic":"itqcm - como","portofloadingtype":"a","showpopupbtn":false}}     ] }); 

you can attach format function part of template:

ext.application({     name: 'fiddle',      launch: function() {         ext.viewport.add({             xtype: 'list',             itemtpl: ['{name:this.doit}', {                 doit: function(v) {                     return v + ' go';                 }             }],             store: {                 fields: ['name'],                 data: [{                     name: 'a'                 }]             }         });     } }); 

fiddle here.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

Laravel mail error `Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [ #0]` -

c# SetCompatibleTextRenderingDefault must be called before the first -