PDA

View Full Version : Issue with YAHOO.ext.grid.Grid addlistener



mpirzada
31 Jan 2008, 3:59 AM
Hi,
I have code that builds Yahoo grid and displays data in rows. When I double click any row, it calls another function that brings a pop-up to display detailed results for selected row. I am attaching a listener to each row for doubleclick event.

It works fine with IE but not with FirFox. Here is the code:

function postGrid(req) {
if (req.readyState == 4) {
if (req.status == 200) {
_colData = req.responseText;
var sort = YAHOO.ext.grid.DefaultColumnModel.sortTypes;
var colData1 = new YAHOO.ext.grid.DefaultColumnModel(eval(_colData));
var rowData = ibos;
var dataModel = new YAHOO.ext.grid.DefaultDataModel(rowData);
var grid = new YAHOO.ext.grid.Grid('dynamicTable', {
dataModel: dataModel,
colModel: colData1,
trackMouseOver: true
}
);
grid.autoSizeHeaders = true;
grid.render();
grid.getSelectionModel();
grid.addListener('rowdblclick', onRowClick);
}
}
}

function onRowClick(grid, rowIndex, e){
if(grid.getRow(rowIndex) != null) {
currentRowIndex = grid.getSelectedRowIndex();
//var _a = grid.getFirstCell(grid.getRow(rowIndex), false);
var _a = grid.getFirstCell(grid.getRow(currentRowIndex), false);
var _b = _a.firstChild;
var _c = _b.firstChild;
downliner = _c.title;
alert(downliner);
popupDownliner(downliner);
}
}

There is tree on left. If I click the tree node, it builds the grid and displays the data rows.
The error with FireFox is that, when I click the tree node: It displays the alert(downliner);
twice while I add only 1 listener with the each grid row. Why it displays twice?
I have investigated further and to my understanding, it somehow registers number of clicks on the node and when I click grid it also displays the node elelment. It should not show node element because I need only grid elelment to display result.

How to fix?

Somebody please help.

Thanks in advance.

evant
31 Jan 2008, 4:04 AM
You have the wrong forum. This is Ext, not YUI.

mpirzada
31 Jan 2008, 4:22 AM
Hi,

Do you know link to YUI forum?

Thanks.

evant
31 Jan 2008, 4:24 AM
http://www.google.com.au/search?hl=en&q=yui+forum&btnG=Google+Search&meta= 8-|

mpirzada
31 Jan 2008, 4:35 AM
Thanks a lot for help.

mpirzada
31 Jan 2008, 4:42 AM
YAHOO.ext.grid.Grid is ext to my understanding and not yui. I am using both. YUI for building tree and ext for grid. The issue is with ext part and not yui.

What you think?

Thanks.

evant
31 Jan 2008, 4:47 AM
YAHOO.ext is an extremely old version, it was superseded by Ext 1.0 and subsequently Ext 2.0. You won't really be able to find support for it anymore. I'd suggest you upgrade.

mpirzada
31 Jan 2008, 5:04 AM
Hi,

How can you tell, it is quite old?

If it is old, how can I upgrade to latest?

Thanks for help.

evant
31 Jan 2008, 5:06 AM
It is old because newer versions were released.

http://extjs.com/download

http://extjs.com/learn

mpirzada
31 Jan 2008, 10:35 AM
Thanks