+ Start a Discussion
wpatterswpatters 

Dynamic table creation with visualforce & javascript

Ok, so I'm trying to create tables based on strings i have in a couple of parallel arrays using visualforce.  My code is good, but when I run it, strange things occur:

Code:
tableText+="<tr><td class='included' onClick=\"toggleObj("+i+", '"+ObjArr2[i]+"', this)\" colspan='2' onMouseOver='flipOn(this)' onMouseOut='flipOff(this)' id='"+ObjArr[i]+"TD'><span class='fieldhdr'>"+ObjArr2[i]+" Object</span></td></tr>";

 becomes:

Code:
tableText+="<tr><td class="included" colspan="2" id="&quot;+ObjArr[i]+&quot;TD" onMouseOut="flipOff(this)" onMouseOver="flipOn(this)" onClick=\"toggleObj("+i+", '"+ObjArr2[i]+"', this)\"><span class="fieldhdr">"+ObjArr2[i]+" Object</span></td></tr>";


Quotation marks are turned into &quot; and it totally re-arranges things, puts double quotes instead of singles, and I don't understand why.  I've tried putting \ in front of the ', and this does prevent the text from being re-arranged but throws the same error in firefox: "Missing ; before statement"  This would be incredibly useful for me, and make my page much more dynamic.  Is there a workaround?
Ron HessRon Hess
I think the tag   < apex :  PageBlockList   will build a list just like you want without the quoting.

needhelpneedhelp
May I know how you pass the tableText to VF page and display as a table?