PDA

View Full Version : [FIXED-EXTJSIV-1767][B3]ActionColumn bug and issues



atian25
25 Apr 2011, 6:45 PM
1. bug, action's handler is not calling when item's handler=null

processEvent : function(type, view, cell, recordIndex, cellIndex, e){
var m = e.getTarget().className.match(this.actionIdRe),
item, fn;
if (m && (item = this.items[parseInt(m[1], 10)])) {
if (type == 'click') {
fn = item.handler;
if (fn || this.handler) {
fn.call(item.scope||this.scope||this, view, recordIndex, cellIndex, item, e);
}
} else if ((type == 'mousedown') && (item.stopSelection !== false)) {
return false;
}
}
return this.callParent(arguments);
},


2.issues:
support text,hideIndex and others just like rowactions...

aconran
26 Apr 2011, 1:52 PM
Could you explain in more detail what #1 is?

I understand that #2 is a set of feature requests that you'd like to see in a future version.

atian25
26 Apr 2011, 4:54 PM
fn = item.handler;
//if fn==null and handler!=null, will got error
if (fn || this.handler) {
fn.call(item.scope||this.scope||this, view, recordIndex, cellIndex, item, e);
}


if i define actioncolumn's handler without define items's handler, will got error:

Uncaught TypeError: Cannot call method 'call' of undefined
Ext.define.processEventext-all-debug.js:56261



{
text: '????',
header: '????',
xtype: 'actioncolumn',
width: 60,
stopSelection: false,
handler:function(){console.log('a')},
items: [
{iconCls:'icon-edit',action:'edit',tooltip:'??',text:'??'},
{iconCls:'icon-delete',action:'delete',tooltip:'??',text:'??'}
]
}

evant
26 Apr 2011, 5:40 PM
Thanks for the report, the first issue has been resolved.

I've logged another ticket to look at possible improvement for the action column.

atian25
26 Apr 2011, 5:49 PM
another feature:

fireevent when click item, with params: icon-cls/id etc..

that's what i do at actioncolumn's handler, and process event at controller.




init: function() {
this.control({
'contact button[action=add]':{
click: this.addRecord
},
'contact button[action=delete]':{
click: function(){this.deleteRecord()}
},
'contact actioncolumn':{
click: this.onAction
}
});
},
onAction: function(view,cell,row,col,e){
//console.log(this.getActioncolumn(),arguments, e.getTarget())
var m = e.getTarget().className.match(/\bicon-(\w+)\b/)
if(m){
//????
this.getGrid().getView().getSelectionModel().select(row,false)
switch(m[1]){
case 'edit':
this.getGrid().getPlugin('rowediting').startEdit({colIdx:col,rowIdx:row})
break;
case 'delete':
var record = this.getGrid().store.getAt(row)
this.deleteRecord([record])
break;
}
}
}


use "e.getTarget().className.match(/\bicon-(\w+)\b/)" to detect item, which i think is ugly, wish it could have a better way.