| Page 1 of 1 | [ 3 posts ] |
|
Hello All,
Given a datatable with multiple records, I'm trying to highlight one of it's rows (records) based on the data it contains. I guess I need to use the method highlightRow ( http://developer.yahoo.com/yui/docs/YAH ... ghlightRow ). As you can see from the code snippet provided below, I can successfully obtain the record id of the row I want to highlight/select. But the "highlightRow" method is expecting the row id of such method, which I don't know how to obtain. Here's a simplified code snippet: Code: .... .. _myDt = new YAHOO.widget.DataTable("dtId", dtCols, dtSource, dtCFG); _myDt.CLASS_HIGHLIGHTED = myCSSClass; var currRowId = GetCurrentRowId(_myDt.getRecordSet()); _myDt.highlightRow(currRowId); ... .. function GetCurrentRowId ( recSet ) { var result = null; for(var i=0; i<recSet.getLength(); i++) { var rec = recSet.getRecord(i); if(rec.getData("pgm_id") == _currPgmId)// _currPgmId is a predefined global variables. { result = rec.getId(); // break; } } return result; } ] Thank you in advance for any help you can provide. ~G |
|
"..is expecting the row id of such method...". sorry, I meant to say "is expecting the row id of such record"
|
|
The code you show should work, highlightRow takes either the id as you show, or the instance of Record, or a reference to any HTML element in the row or the ordinal position of the row (the value of i in your code). That means you might return rec.getId(), rec or i and it should work just the same.
If it doesn't work, make sure your GetCurrentRowId is actually returning something other than null. |
| Page 1 of 1 | [ 3 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group