|
|
I'm a really old programmer new to Dreamweaver CS4, PHP, JS, DOM, AJAX, HTML,
CSS, blah blah. I'm really impressed with DW and people who have mastered this
stuff.
I'm building a site with a MySQL multidimensional DB using PHP and DW to build
a HTML table to use as a Spry DataSet- in the same page as the table.
I use useColumnsAsRows so users can compare values in several columns (<10) to
what they're entering in forms split into Tabbed Panels. When user enters the
data I want to stick it in the column to compare his answers to the database
answers. User sorting of these columns to rank values is necessary.
I'm assuming I should use a JS loadData() to refresh the Spry DataSet
(arrays?) which is supposed to happen asynchronously. I am clueless as to why
my little test code doesn't seem to update the DataSet when I put it in the
HTML table and do the loadData. I have no idea what the loadData parameter is
and whether I'm actually putting the data in the table. New to DOM, et all.
Here's what seems to be the relevant code.
var ds1 = new Spry.Data.HTMLDataSet(null, "rsLive", {firstRowAsHeaders: false,
useColumnsAsRows: true, tableModeEnabled: false, sortOnLoad: "To_college",
sortOrderOnLoad: "ascending", columnNames: ['Question', 'Your_Answer',
'Like_you', 'To_college', 'Dropping_out', 'Girls_16', 'Boys_16'], rowSelector:
"tr.question,.youranswers,.allcomp", dataSelector: "td.family"});
ds1.setColumnType("Girls_16", "number");
ds1.setColumnType("Boys_16", "number");
//-->
</script>
<script type="text/javascript">
function changeContent()
{<!--Test putting user data into HTML Data Source -->
var x=document.getElementById('rsLive').rows[1].cells;
alert(x[1].innerHTML);
x[1].innerHTML="7";
<!--Reload Spry arrays from HTML table (Tablename the parameter?) -->
var dsSpecials = new Spry.Data.HTMLDataSet ('rsLive');
dsSpecials.loadData();
alert ("stall to get reloaded")
<!--Get current table value -->
var y=document.getElementById('rsLive').rows[1].cells;
alert(y[1].innerHTML);
}
</script>
</head>
<body>
<form>
<input type="button" onclick="changeContent()" value="Change content">
</form>
<div id="apDiv1">
<table border="1" id="rsLive">
<tr class="question">
<td class="family">Family question 1</td>
<td class="family">Family question 2</td>
<td class="family">Family question 3</td>
<td class="family">Family question 4</td>
|
|