|
Re: Datatable - select first record when data has been (re)fetched and tbl. is drawn
Satyam,
> ...renderEvent upon re-rendering the table except
> for the first time around. The first time initEvent
> gets fired, that's the one you are looking for.
Perfect! yes indeed initEvent is firing every time I populate or
repopulate the dataTable.
Honestly I would have never come to that idea, as I never destroy the
datatable and was associating initEvent with the constructor and not
assuming it would also fire after calling initializeTable() (whitch of
course I also did not have in focus when searching for the "bug").
So in case anyone else needs it, this it what works even on subsequent
repopulating the dataTable:
YAHOO.ddTech....oDataTable.subscribe(
"initEvent",
function() {
var oTable = YAHOO.ddTech...oDataTable;
var nRecords = oTable.getRecordSet().getLength();
if (nRecords > 0){
// Programmatically select first row
// and set focus to the table
oTable.selectRow(oTable.getTrEl(0));
oTable.focus();
}
else {
theOtherControl.focus();
}
}
);
Thanks for pointing me in the right direction.
Regards
Frank
|