For the life of me, I cannot figure out how to manually loop through a recordset.
I don't want to display a datatable, but instead am creating a window with a list of custom icons for a user interface.
All I want to do is manually go through a recordset object, row-by-row, and generate HTML based on each column in it, as needed... using a simple JavaScript loop.
(the client recordset object is generated from a server-side database using C - doesn't matter how for this particular help post)
Example of how I create my recordset:
var objYuiRs; /* my global that I'll use 'outside' of YUI -- I think this is the best way??? maybe not? */
YUI().use('recordset', function (Y) {
var recordsFromDB = [ /* these get populated to the client here, by a server-side loop -- how exactly is not important for this example :) */
{ recno:0, position:1, label:"Emergency!", desc:"Click to notify of an urgent emergency.", icon:"msgEmergency.png" }
{ recno:1, position:2, label:"Request staff meeting", desc:"Click to request a normal staff meeting.", icon:"msgDefault.png" }
{ recno:2, position:3, label:"Request technical help", desc:"Click to ask for technical help.", icon:"msgHelpTech.png" }
],
temprs = new Y.Recordset({records: favsFromDB});
objYuiRs = temprs; /* make the recordset created above available in the global javascript */
});
I know I have my recordset object working (globally, even), because I can then hop into the Chrome console and type "objYuiRs._______" and it pops up the standard YUI recordset method choices and such. Furthermore, when I run (from the console) "objYuiRs.getValuesByKey()" it returns all the correct values.
But how do I take this beyond the debugger console and programatically iterate through each record in JavaScript?
I feel like the answer is right under my nose and I'm missing something obvious? Help! LOL