-
23 Sep 2011 2:26 AM #1
Unanswered: Grid row Right click [Context menu] Open new url
Unanswered: Grid row Right click [Context menu] Open new url
Hi
I have a code in which I am showing Grid and the on each row click there is Context menu like edit, delete.
Now I want to open new page/ URL when I clicked on Edit option.
I have attached the screen shot with this. Please have a look at it. So when I clicked on Edit Record I want this should open new page/ URL with parameters.
ContextMenuURL.jpg
My Code is something like this
var grid = Ext.create('Ext.grid.Panel', {
store: store,
listeners:
{
itemcontextmenu: function(view,record,item,index,e,eOpts)
{
var menu= new Ext.menu.Menu();
menu.add({text:"Edit Record",icon: 'css/images/add16.gif',handler:onClick(view,record,item,index,e,eOpts)});
menu.add({text:"Copy Record",handler:
function ()
{
var rec = store.getAt(index);
var NewCompany=rec.get('company');
var NewPrice=rec.get('price');
var NewChange=rec.get('change');
var NewPctChange=rec.get('pctChange');
var NewLastChange=rec.get('lastChange');
var r = Ext.ModelManager.create({
company:NewCompany,
price:NewPrice,
change:NewChange,
pctChange:NewPctChange,
lastChange:NewLastChange
}, 'TestForm');
store.insert(0, r);
}
});
menu.add({text:"Delete Record",handler://RowDelete(grid)
function()
{
var sm = grid.getSelectionModel();
store.remove(sm.getSelection());
}
});
e.stopEvent();
menu.showAt(e.xy);
}
},
columnLines: false,
Can anyone please suggest me the solution for this?
-
23 Sep 2011 4:42 AM #2
try something like this maybe:
Code:menu.add({ text:"Edit Record", icon: 'css/images/add16.gif', handler: function(view,record,item,index,e,eOpts){ // get the selected record var my_record = view.getSelectionModel().getLastSelected(); // we will pass the company field as a paramater var my_record_param = my_record.data['company']; // let's create the url var my_url = 'http://www.myurlgoeshere.com/pass_parameter.php?p=' + my_record_param // now you can create a Ext.window and put an iframe with the url in the html like so.. new Ext.Window({ width: 500, height: 500, html: '<iframe width="300" height="300" src="' + my_url + '"</iframe>' }).show(); // or do it the old fashion way window.open(my_url); });
-
23 Sep 2011 5:01 AM #3
Thanks a lot for this help



Reply With Quote