PDA

View Full Version : [4.0.2a] actioncolumn disable property not working



medusadelft
8 Aug 2011, 10:02 AM
REQUIRED INFORMATION


Ext version tested:

Ext 4._0.2___ rev _a___


Browser versions tested against:

____
Chrome 13
FF4 (firebug 1.3.0.10 installed)


Description:

The actioncolumn xtype for a grid has the property 'disabled'. When I set this one in my columnmodel, to true, I expect every line to have that button disabled. But it is not. I can still click the delete button and get the alert. Also, the image is not grey-ed out.


Steps to reproduce the problem:

My column-definition:

,{xtype: 'actioncolumn'
,width:42
,items: [{
icon: 'resources/icons/add.png'
,tooltip: 'add another line'
,action: 'add'
,handler: function(grid, rowIndex, colIndex) {
alert('add');
}
}
,{
icon: 'resources/icons/delete.png'
,tooltip: 'Delete line'
,text: 'delete'
,disabled: true
,handler: function(grid, rowIndex, colIndex) {
alert('delete');
}
}]
}




The result that was expected:

see above


The result that occurs instead:

see above


Test Case:



,{xtype: 'actioncolumn'
,width:42
,items: [{
icon: 'resources/icons/add.png'
,tooltip: 'add another line'
,action: 'add'
,handler: function(grid, rowIndex, colIndex) {
alert('add');
}
}
,{
icon: 'resources/icons/delete.png'
,tooltip: 'Delete line'
,text: 'delete'
,disabled: true
,handler: function(grid, rowIndex, colIndex) {
alert('delete');
}
}]
}




HELPFUL INFORMATION


Screenshot or Video:

n/a


See this URL for live test case: http://


Debugging already done:

none


Possible fix:

not provided


Additional CSS used:

only default ext-all.css


Operating System:

n/a________

Animal
8 Aug 2011, 11:23 AM
A Column is in fact a Header. It's a Component. So it inherits the disabled config even though it is not in fact disablable. It's just a Header.

In fact it's the action items which you want to be disablable. That would mean an implementation of enable/disable which cascaded through all rows adding/removing a class. And the flag would have to be set in the items.

So, I'll add a disableAction(index) and enableAction(index) method to the ActionColumn class. That enables and disables each action defined within the column.

How's that?

medusadelft
8 Aug 2011, 10:34 PM
Hi Animal,

Yes, that would be great!
I know it's a header, but 'align: right' also works for the cells (and other config properties). So in that perspective, I was hoping disable would work too.

I'm having problems getting the icons of the actioncolumn from my MVC-controller. Any ideas how I can get the click-event from this.control ?

Thanks for your response!

Animal
9 Aug 2011, 12:45 PM
Use DomQuery to access te icons.

There is no click event. You need to write handlers.

medusadelft
10 Aug 2011, 3:27 AM
Ok, I'm gonna give it a try.

Thanks!

flatbugz
2 Sep 2011, 8:24 AM
I'm having the same issue. Any progress on this? Perhaps a sneak preview of any code you have for use in a temporary override in the meantime. Or code the OP has devised to address this, so I don't have to re-invent the wheel.

Thanks in advance

flatbugz
2 Sep 2011, 8:51 AM
I'm having the same issue. Any progress on this? Perhaps a sneak preview of any code you have for use in a temporary override in the meantime. Or code the OP has devised to address this, so I don't have to re-invent the wheel.

Thanks in advance

Actually in our instance, we want to disable action columns on a per row basis, based on a value in another field of the same record. To give you an example I am current using an alert instead:


var columns = [{
menuDisabled:true,
resizable:false,
xtype:'actioncolumn',
align:'center',
width: 32,
items:[{
icon:'/images/icons/delete/delete_16x16.png',
tooltip:'Delete',
handler :function(grid, rowIndex, colIndex){
var rec = grid.getStore().getAt(rowIndex);


if (rec.get('finished_at')) {
Ext.Msg.alert('Alert', 'Task Already Finished');
return;
}

//etcetera



So if this sort of use case could be taken into consideration when devising the solution intended for release, that would be fantastic. Thanks for your consideration

webfriend13
11 Apr 2012, 12:50 AM
Hello Guys,

Any updates on this. Using disableAction is disabling entire column (button in each row is getting disabled). I want to disable a particular row. How can we do this ?

cyborat
22 Jun 2012, 9:14 AM
I too would like to know how to enable/disable buttons on a per-row basis. I've been tinkering around, and have not yet found the proper per-row updating of the action column. Would be best if you can enable/disable the button, as well as remove the handler and change the tooltip, i.e. if a value in each particular row is a certain value, or that row's task is complete, I still want the row visible, but want the user to immediately know that no further action is needed on that record.

Animal
22 Jun 2012, 10:18 AM
There is only one ActionColumn.

You will have to inject a getRowClass implementation which adds a row class to disabled rows, and then change selectors to be



.myDisabledRowClass .myActionIcon


And specify disabled rendering style.

And then in your handler, you need to decide whether to perform the action or not.