<script>
var obj = new AW.UI.Grid;
obj.setStyle("width", "100%");
var data = [];
data = [[1,2,3,4,5]];//TRY COMMENTING OUT THIS LINE
obj.setCellData(data);
obj.setRowCount(data.length);
obj.setColumnCount(5);
document.write(obj);
function add() {
data[data.length] = [1,2,3,4,5];
obj.addRow(data.length-1);
}
</script>
<button onclick="add()">add</button>
<html>
<head>
<script src="activewidgets/runtime/lib/aw.js"></script>
<link href="activewidgets/runtime/styles/xp/aw.css" rel="stylesheet"></link>
</head>
<body>
<script>
var obj = new AW.UI.Grid;
obj.setStyle("width", "100%");
var data = [];
// data = [[1,2,3,4,5]];//TRY COMMENTING OUT THIS LINE
obj.setCellData(data);
obj.setRowCount(data.length);
obj.setColumnCount(5);
document.write(obj);
function add() {
data[data.length] = [data.length,2,3,4,5];
obj.addRow(data.length-1);
if (data.length == 1) {
obj.setCellData(data);
obj.refresh();
}
}
function del(){
var i = obj.getCurrentRow();
if (i == -1) {
alert("no more rows to delete");
return;
}
obj.deleteRow(i);
}
</script>
<button onclick="add()">add</button>
<button onclick="del()">del</button>
</body>
</html>
<html>
<head>
<script src="activewidgets/runtime/lib/aw.js"></script>
<link href="activewidgets/runtime/styles/xp/aw.css" rel="stylesheet"></link>
</head>
<body>
<script>
var obj = new AW.UI.Grid;
obj.setStyle("width", "100%");
var data = [];
data = [[1,2,3,4,5]];//TRY COMMENTING OUT THIS LINE
obj.setCellData(data);
obj.setRowCount(data.length);
obj.setColumnCount(5);
obj.deleteRow(0);
document.write(obj);
function add() {
data[data.length] = [data.length,2,3,4,5];
obj.addRow(data.length-1);
}
function del(){
var i = obj.getCurrentRow();
if (i == -1) {
alert("no more rows to delete");
return;
}
obj.deleteRow(i);
}
</script>
<button onclick="add()">add</button>
<button onclick="del()">del</button>
</body>
</html>
This topic is archived.