jQuery is so powerful when you work the DOM - the methods available do so much, once you get fully versed in them.
The .each() method is meant to work an array of "wrapped-elements" - DOM elements specifically.
But it can be used for a neat loop on any array.
In the image below we have an array of objects: layout(46) and I want to iterate along those objects and build a "printable" multi-line string.
$(...) calls the jQuery library, for those not used to seeing syntax like that. The "$" sign introduces the library call.
Here is the code. Looks a lot like LINQ in .net. I'll post a screen shot of the "popup errorMessage" in the next post.
Code:var strLayout = ""; . . . $(g_objGrid[intGO].awcoptions.reportinfo.layout).each(function () { strLayout += (strLayout.length != 0 ? "<br />" : "") + $.toJSON(this);; }); errorMessage("Report Layout", strLayout);




Reply With Quote