javascript - How to disable the delete button using if condition in Extjs -
how disable delete button using if condition in extjs ex;i want disable button if satifies given if condition else remain enabled. if(validaction(entityhash.get('entity.xyz'),actionhash.get('action.delete')))
this grid delete button code.
ext.reg("gridheaderbar-inactive", ad.gridinactivebutton,{ xtype: 'tbspacer', width: 5 }); ad.gridcampdeletebutton = ext.extend(ext.toolbar.button, { //text: 'delete', cls: 'ad-img-button', width:61, height:40, iconcls: 'ad-btn-icon', icon: '/webapp/resources/images/btn_del.png', handler:function(){ statuschange(this.parentbar.parentgrid, 'delete') } });
create actioncolumn
, make custom renderer:
{ xtype: 'actioncolumn', width: 38, renderer: function (val, metadata, record) { this.items[0].icon = '${context_path}/images/' + record.get('filetype') + '.png'; this.items[0].disabled = !record.get('isdownloadactionenable'); this.items[1].disabled = !record.get('isdeleteactionenable'); metadata.style = 'cursor: pointer;'; return val; }, items: [ { icon: '${context_path}/images/pdf.png', // use url in icon config tooltip: 'download', handler: function (grid, rowindex, colindex) { //handle } }, { icon: '${context_path}/images/delete.png', // use url in icon config tooltip: 'delete', handler: function (grid, rowindex, colindex) { handle } } ] }
in example see additionally how change dynamically icon.
Comments
Post a Comment