:: Forum >>

Data Grid From an HTML Table or Database

I see how to add data from a javascript var, but how do I add data from an html table or from a database query and still use the grid control.

var input = new AW.UI.Input;
input.setControlText("Input");
input.setControlImage("folder");
var grid1 = new AW.UI.Grid;
grid1.setId("grid1");
grid1.setHeaderTemplate(input, 0);
grid1.setHeaderText("Header");
grid1.setCellText("cell");
grid1.setColumnCount(7);
grid1.setRowCount(5);
grid1.refresh();
input.onControlValidated = function(text){
grid1.setCellText(text, 0, 0);

For example I'd like to do this.
<table style="width: 100%">
<tr id="colHdrs">
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
<tr id="colData">
<td>Data1</td>
<td>Data2</td>
<td>Data3</td>
<td>Data4</td>
<td>Data5</td>
<td>Data6</td>
<td>Data7</td>
<td>Data8</td>
<td>Data9</td>
</tr>
</table>
Rudy
Thursday, May 15, 2008

http://www.activewidgets.com/grid.examples/php-mysql.html
http://www.activewidgets.com/grid.examples/asp-adodb.html
http://www.activewidgets.com/grid.examples/saving-changed-cells.html
http://www.activewidgets.com/javascript.forum.21574.13/grid-cell-edit-blocked-when.html
Thursday, May 15, 2008
Thank you. But how do I get the column headers and data from the html tags on the form?
Rudy
Thursday, May 15, 2008
You can use

grid.setCellText(function(c, r){return ...});

which will return proper values from the table using DOM calls.
Alex (ActiveWidgets)
Thursday, May 15, 2008

This topic is archived.


Back to support forum

Forum search