extjs - Compare date from combobox with current date -


i have combobox data store:

fields: [     {name: 'name',  type: 'string'},     {name: 'createdate',  type: 'string'} ] 

field 'createdate' has format "03.05.2015", combobox outputs field 'name':

{     xtype: 'combobox',     fieldlabel: 'nametext',     store: 'storeofnames',     querymode: 'local',     displayfield: 'name',     valuefield: 'id' } 

i want next:

combobox output: name + (if date in field createdate >= current date) add in combobox data 'createdate'.

you can trick: in model add item like:

{     name: 'display',     mapping: function(rec) {         return rec.name + (new date(rec.createdate) >= new date()             ? ' ' + rec.createdate             : '');     } } 

and in combobox change displayfield:

displayfield: 'display' 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

javascript - Bootstrap Popover: iOS Safari strange behaviour -

spring cloud - How to configure SpringCloud Eureka instance to point to https on non standard port -