By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,796 Members | 1,240 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,796 IT Pros & Developers. It's quick & easy.

dynamic content updated, tho not displayed

P: 2
I have a piece of js that creates a dynamic form ....
simplified it's as follows...

Expand|Select|Wrap|Line Numbers
  1. var oForm = document.getElementById('form');
  2. var aData; // array of db values
  3. var table = document.createElement('table'); 
  4. for(var i in aData) { // loop thru db rows 
  5.    var tbody = document.createElement('tbody'); 
  6.    for(var j in aData[i]) { // loop thru table rows 
  7.       var row = document.createElement('tr'); 
  8.       for(var k in aData[i][j]) { 
  9.          var col = document.createElement('td'); 
  10.          var text = 'row:' + j + ' col:' + k; 
  11.          var node = document.createTextNode(text); 
  12.          col.appendChild(node); 
  13.          row.appendChild(col);
  14.       } 
  15.       tbody.appendChild(row); 
  16.    } 
  17.    table.appendChild(tbody); 
  18. }
  19. oForm.appendChild('table'); 
  20.  
the result being that the code is updated (viewed as grey text in firebug) tho the display only shows the textNodes, no table/table structure.

what I've tried as far ....
insertCell/insertRow methods
checked if any prev js would interfere
displaying alternative table structures, ie without tbody step

a possible hack ....
it works to a degree when doing as follows ...
Expand|Select|Wrap|Line Numbers
  1. var oForm = document.getElementById('form');
  2. var temp = oForm.innerHTML; 
  3. oForm.innerHTML = ''; 
  4. oForm.innerHTML = temp; 
  5.  
effectively refreshing the element, tho all styles and table structure is ignored.
Oct 1 '08 #1
Share this Question
Share on Google+
2 Replies


P: 2
sorted!!! in case anyone else has the same issue ....

the above code sits inside an xsl transformed xml document set at xsl:stylesheet version="1.0" method being xml, and a header of 'Content-type:text/xml'

changing namespace to as follows ..... (I'm not in the mood to sift thru attributes here, so here's the whole lot!)

Expand|Select|Wrap|Line Numbers
  1. <xsl:stylesheet version="2.0"
  2.     xmlns:xhtml="http://www.w3.org/1999/xhtml"
  3.     xmlns="http://www.w3.org/1999/xhtml"
  4.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  5.     xmlns:xs="http://www.w3.org/2001/XMLSchema"
  6.     xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
  7.     xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes" exclude-result-prefixes="xhtml xsl fn xs xdt"
  8. >
  9. <xsl:output 
  10.     method="html" 
  11.     version="1.0" 
  12.     encoding="utf-8" 
  13.     doctype-public="-//W3C//DTD XHTML 1.1//EN" 
  14.     doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" 
  15.     indent="yes"
  16.     cdata-section-elements="script"
  17. />
Oct 1 '08 #2

acoder
Expert Mod 15k+
P: 16,027
Thanks for sharing your solution.

PS. please use code tags when posting code. Thanks.
Oct 1 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.