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
Post a Comment