First post!
June 8th, 2006
So I’ve finally gotten around to posting an entry to my unread blog.
Today I’m going to post a little javascript code. The purpose of this code is to loop through all the elements on a page and, in my case, render a grid (By grids I mean ComponentArt grids). The reason I wrote a loop like this is that I wanted to just put this on any page and have it update a grid. Being so I wouldn’t have to worry about updating pages all over the place if I modify or change something.
function renderGrids()
{
var gridMatch = new RegExp(“_gd.*$”);
for(i=0; i < document.forms[0].elements.length; i++)
{
name = document.forms[0].elements[i].name;
if(gridMatch.test(name))
eval(name.substring(0,name.lastIndexOf(‘_’))+‘.Render();’);
}
}Pretty simple code to automate something that would take many (cumbersome) hours to do by hand for all the pages.
{
var gridMatch = new RegExp(“_gd.*$”);
for(i=0; i < document.forms[0].elements.length; i++)
{
name = document.forms[0].elements[i].name;
if(gridMatch.test(name))
eval(name.substring(0,name.lastIndexOf(‘_’))+‘.Render();’);
}
}Pretty simple code to automate something that would take many (cumbersome) hours to do by hand for all the pages.
-Jeremy