PDA

View Full Version : selection model listener demands pop-up allow



harmomelodic
3 Nov 2009, 6:54 AM
Howdy,
I am coding a gridpanel where I using a listener to detect a rowselect and open a url when a selection occurs. The problem is that the browser blocks this unless the user allows pop-up windows. I would like an alternative method that does not require the user enable pop-ups.
I believe the problem is that Ext is creating a layer of indirection between the OnClick and the open call.

Here is the relevant code (inside the gridpanel config)...


sm: new Ext.grid.RowSelectionModel(
{listeners:
{rowselect:
function (selectionModel, rowIndex, selectedRecord) {
window.open(selectedRecord.get('link'));
}
}
}),

harmomelodic
13 Nov 2009, 12:57 PM
bump

Elijah
13 Dec 2009, 11:33 AM
Question..


sm: new Ext.grid.RowSelectionModel(
{listeners:
{rowselect:
function (selectionModel, rowIndex, selectedRecord
) {
window.open(selectedRecord.get('link'));
}
}
}),

when an item is selected in a grid and this fires, what is the structure of the selectedRecord
I am trying to get at information but can not figure out how to get ant anything since I dont even know what the structure is of selectedRecord

Elijah
13 Dec 2009, 12:18 PM
Ok, I found in the forum how to get at the data for the selected row.


rowselect: function(smObj, rowIndex, record) {
var dataObj = record.data;
}

CrazyEnigma
13 Dec 2009, 10:13 PM
@harmomelodic

There are several ways of doing this. You could try to use a ManagedIFrame example.

Use:


var win = Ext.Window({
title: 'My opened link',
items: {
xtype: 'iframepanel',
defaultSrc: selectedRecord.get('link')
}
});
win.show();


Or the less elegant way:


var win = Ext.Window({
title: 'My opened link',
html: '<iframe src=' + selectedRecord.get('link') + '></iframe>'
});
win.show();


I didn't include the sizing or configurations.

Or if your link contains just plain html, you can use the load on the window. It pops a EXT JS Window for you instead of a browser window. Hopes this gives you a starting point.