PDA

View Full Version : 4.2.0 GridPanel ActionColumn item isDisabled() method is never called



damirko
23 Apr 2013, 1:38 AM
REQUIRED INFORMATION

Ext version tested:


Ext 4.2.0
Browser versions tested against:

Google Chrome 25.0.1364.160 (Windows 7) — FAIL

Firefox 16.0.2 (Windows 7) — FAIL

Internet Explorer 9 (Windows 7) — FAIL
DOCTYPE tested against:

<!doctype html>
Description:

I have a problem with ActionColumn item's isDisabled() method - it never get called, so I cannot disable certian actions on some rows.
Steps to reproduce the problem:

Try to run the supplied test case on your machine
The result that was expected:


Disable some actions on some rows via isDisabled() method
The result that occurs instead:

the isDisabled() method never fires (tried with setting up breakpoints, console logs, etc...)
Test Case:

<!DOCTYPE html>
<html>
<head>
<title>GridViewDragDrop causes scrolling on selection</title>


<link rel="stylesheet" href="res/js/lib/ExtJs/resources/css/ext-all-gray.css" />
<script src="res/js/lib/ExtJs/ext-all.js"></script>


<style type="text/css">
.tool {
display: inline-block;
width: 16px;
height: 16px;
margin: 0 4px;
}


.rename { background: green; }
.delete { background: red; }


.x-item-disabled { display: none; }
</style>


<script>
Ext.onReady(function () {
Ext.tip.QuickTipManager.init();


Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone', 'deletable', 'renamable'],
data: [
{ 'name': 'Lisa', "email":"lisa@simpsons.com", "phone":"555-111-1224", "deletable": true, "renamable": true },
{ 'name': 'Bart', "email":"bart@simpsons.com", "phone":"555-222-1234", "deletable": true, "renamable": false },
{ 'name': 'Homer', "email":"home@simpsons.com", "phone":"555-222-1244", "deletable": false, "renamable": true },
{ 'name': 'Marge', "email":"marge@simpsons.com", "phone":"555-222-1254", "deletable": false, "renamable": false }
]
}),
columns: [{
text: 'Name',
dataIndex: 'name'
}, {
text: 'Email',
dataIndex: 'email',
flex: 1
}, {
text: 'Phone',
dataIndex: 'phone'
}, {
width: 100,
xtype: 'actioncolumn',
text: 'Tools',


items: [{
iconCls: 'tool rename',
tooltip: 'Rename',
isDisabled: function( view, row, col, item, record ) {
return record.get('renamable');
},
handler: function() {
alert('Rename');
}
},{
iconCls: 'tool delete',
tooltip: 'Delete',
isDisabled: function( view, row, col, item, record ) {
return record.get('deletable');
},
handler: function() {
alert('Delete');
}
}]
}],
height: 400,
width: 600,
renderTo: Ext.getBody()
});
});
</script>
</head>
<body></body>
</html>
Additional info:
I would also like to add isDisabled to the defaults section of ActionColumn, but defaults' properties also don't get applied to ActionColumn items (which is a totally different bug altogether, but I didn't have time to create test case for it).

slemmon
23 Apr 2013, 8:53 AM
Your test case is working ok for me in 4.2 and up.

damirko
23 Apr 2013, 11:25 PM
Your test case is working ok for me in 4.2 and up.

You are correct my sir :). I am sorry, I mistakenly presumed I was using 4.2.0 on my project, but upon further investigation i realized that I was instead using 4.1.1 (switched it in my head with another project, where I was actually using 4.2.0). After upgrading, everything works as expected.

Sorry to have wasted your time, and thanks for the answer.