PDA

View Full Version : [3.x] Grid RowActions Plugin



jsakalos
13 May 2009, 1:03 AM
This is just link to the original plugin that is now Ext 3.x compatible: http://extjs.com/forum/showthread.php?p=329126#post329126

6epcepk
16 May 2009, 4:54 AM
Thank you, im waiting for it!

jsakalos
16 May 2009, 9:11 AM
What are you waiting for? It should work right now with Ext 3.x ;)

Pyja
9 Feb 2010, 1:46 AM
Hi,

In the latest version 3.1.1 of ExtJS ColumnModel, the destroy is the following :


destroy : function(){
for(var i = 0, len = this.config.length; i < len; i++){
this.config[i].destroy();
}
this.purgeListeners();
}When using rowActions, this is added in the columnModel, so called the destroy ()
But rowActions does not have any destroy() function.

2 solutions :
1. Add an empty destroy() function to rowActions (let the current destroy way of work : registering to the 'destroy' of the grid :
grid.on('destroy', this.purgeListeners, this);),
2. create a truly destroy function, and remove the existing way

I'd prefer the 2nd solution.

I hope the 'purgeListeners' don't forget anything to remove/delete

Anyone has already done a patch for rowActions ?

Boring, because a patch (undestand add an override to not modify the original RowActions.js file) means to copy the large init() function, just to comment one line...
And modify the original file means that a new update will destroy any edit.

Saki may update its plugins on its website ?

mask_hot
9 Feb 2010, 2:31 AM
Hi Saki,

I'm trying to associate your Ux.Grid.RowActions and the ux.RowEditor but I've got an issue :
As a rowaction column is not editable, the ux.GridActions initfield function throws an error :


c.getEditor is not a function

Line 6870 in ux-all-debug.js


Do you have a workaround to pass through this?

thx a lot

jsakalos
9 Feb 2010, 9:29 AM
I'd guess that you need to implement getEditor method probably returning false. Let us know then.

mask_hot
9 Feb 2010, 10:16 AM
Thx a lot it works perfectly ;)

tonedeaf
9 Feb 2010, 12:34 PM
In ExtJS 3.1.1, the ColumnModel destroy() function is called when the grid is destroyed:



/**
* Destroys this column model by purging any event listeners, and removing any editors.
*/
destroy : function(){
for(var i = 0, len = this.config.length; i < len; i++){
this.config[i].destroy();
}
this.purgeListeners();
}
The highlighted line causes an error when using Grid RowActions because the destroy() function is undefined for the column where row actions are displayed.

Easy override to fix the error:


/* Fix to supress error for grid RowActions column */
Ext.override(Ext.grid.ColumnModel, {
destroy : function(){
for(var i = 0, len = this.config.length; i < len; i++){
if(this.config[i].destroy != undefined) {
this.config[i].destroy();
}
}
this.purgeListeners();
}
});

jsakalos
9 Feb 2010, 12:47 PM
I'd rather implement destroy function in RowActions....

tonedeaf
9 Feb 2010, 12:50 PM
I'd rather implement destroy function in RowActions....
That's why I called it an easy fix :)

Also, looks like a lot of people noticed it (and with other workarounds):
http://www.extjs.com/forum/showthread.php?p=435475#post435475
http://www.extjs.com/forum/showthread.php?t=91635

mystix
9 Feb 2010, 6:55 PM
even better -- future-proof the ColumnModel's destroy() method by letting Ext.destroy() do all the work:


Ext.override(Ext.grid.ColumnModel, {
destroy : function(){
for(var i = 0, len = this.config.length; i < len; i++){
Ext.destroy(this.config[i]);
}
this.purgeListeners();
}
});

jsakalos
10 Feb 2010, 2:31 AM
Yes, the above is perfect.

mystix
10 Feb 2010, 8:56 AM
@saki, just a heads up: calling setConfig() will result in a similar error too because of the unchecked call to this.config[i].destroy():
http://www.extjs.com/forum/showthread.php?t=91686

i posted an override in that thread (similar to the one above) to fix the problem.

mask_hot
17 Feb 2010, 5:46 AM
Saki, I have some trouble using a listener instead a callback...
Could you have a look here http://www.extjs.com/forum/showthread.php?p=437929#post437929 ?
Thx.

fangstern
2 Jul 2010, 9:48 AM
Hi Saki, do you know if there is any RowMenu plugin anywhere? I've been looking for one for a while. If not, maybe I'll start building one.

Thanks,

jsakalos
2 Jul 2010, 12:50 PM
Context row menu is very easy to code; I'm not sure if it's worth a plugin.

fangstern
4 Jul 2010, 7:20 PM
Hi Saki,

I didn't mean a row context menu. What I need is like a row action with a menu drop down.

jsakalos
5 Jul 2010, 12:40 AM
It is same easy. Display the menu in the listener/callback. You just need to remember the passed arguments so that menu items handlers know with what row they are working.

rualatngua
9 Aug 2010, 8:23 PM
Hi all,

What are differences between this plugins and new ActionColumn on Ext3.3?

Another, I get problem while combine RowEditor and ActionColumn. Click on ActionIcons, the RowEditor will be trigged. I work arround by modify RowEditor.onRowClick to check if column model xtype = 'actioncolumn' then I ignore it. It work. But there are another solution for it?

Thanks all!

C>ode to joy,
Rua lat ngua

jsakalos
10 Aug 2010, 1:13 AM
ActionColumn is new, written for Ext 3.3. RowActions are around since Ext 2.0. I haven't checked yet but if ActionColumn supports all features of RowActions, it may obsolete RowActions for Ext 3.3 applications.

Animal
10 Aug 2010, 5:08 AM
Hi all,

What are differences between this plugins and new ActionColumn on Ext3.3?

Another, I get problem while combine RowEditor and ActionColumn. Click on ActionIcons, the RowEditor will be trigged. I work arround by modify RowEditor.onRowClick to check if column model xtype = 'actioncolumn' then I ignore it. It work. But there are another solution for it?


That is the correct solution for now.

EditorGridPanel listens for the cellclick event to begin editing.

In 3.3, the GridView propagates mouse events though the Ext Observables which need to process events in a logical, "bubbling" outwards order.


It fires the cellclick event first
Then it calls the Column that the click was in and tells that to perform its own event processing
Then it fires the rowclick event.


You can see that any class which listens for cellclick will be informed first. So editing will begin.

ArchBytes
26 Dec 2010, 11:39 PM
Hi, I was wondering how come my RowAction doesn't actually render in my Grid. I also have another plugin, the RowEditor. It doesn't show any errors on firebug, but it doesn't seem to render even just the icon? Is there anything else I have to do?



var rowAction = new Ext.ux.grid.RowActions({
width: 30,
actions: [{
iconIndex: 'acDel',
iconCls: 'silk-add',
qtip: 'Delete Record',
style: 'margin:0 0 0 3px'
}]
});

rowAction.on({
action: function(grid, record, action, row, col){
console.log(record);
}
});



I declared an array for my columns, could that be the reason?

jsakalos
31 Dec 2010, 2:53 AM
You have to add it both to plugins and to ColumnModel config. See the example (http://rowactions.extjs.eu/).

dstrr
12 Jan 2012, 11:44 PM
Possibly because of Ext.grid.GroupingView implementation is changed. (With 3.2.0 it works).
Ext.grid.GroupingView does not contain interceptMouse method.
But the plugin uses this method.

gmprakashlivingstone
12 Sep 2013, 11:11 PM
Hi Buddy,
could you please post the working Codes here ..