PDA

View Full Version : How to implement RowContextMenu in a grid ??



yagi
14 Jul 2010, 6:40 PM
Hi all..

Can someone help me show how to use RowContextMenu ?

I have looked for it in this forum and I found this code:


function menus(grid, rowIndex, e) {
// create the menu container
var contextMenu = new Ext.menu.Menu();
// add sub items
contextMenu.add({text:"Ajouter",handler:ajout,iconCls:'add'});
contextMenu.add({text:"Modifier",handler:modif,iconCls:'edit'});
contextMenu.add({text:"Supprimer",handler:Supprimer,iconCls:'delete'});
contextMenu.add({text:"Supprimer tout",handler:deleteAll,iconCls:'deleteAll'});
contextMenu.add({text:"Actualiser",handler:function(){ store.load({params:{start:0, limit:45 ,sort:'',dir:''}}); },iconCls:'refresh'});
contextMenu.add({text:"Imprimer la fiche",iconCls:'iimprimer'});
contextMenu.add('-');
contextMenu.add({text:"Salariés actifs",iconCls:'valider',handler:actif});
contextMenu.add({text:"Salariés non actifs",iconCls:'inactive',handler:inactif});
// Stops the browser context menu from showing.
e.stopEvent(); // this stops the browser and allows the default grid
// context menu
// show the row context menu here
contextMenu.showAt(e.xy);
}


How can I implement / call it in a grid?

A clear Example code would be nice.. :)

Thanks All..

15 Jul 2010, 4:20 AM
I cover this in chapter 7 in my book. here's the example: http://extjsinaction.com/examples/chapter07/Building_our_complex_gridpanel.html

yagi
19 Jul 2010, 12:48 AM
Ok..,

Thanks a lot Jgarcia :)..