:: Forum >>

AW.JSON.Table addRow error

addRow() error ..
Please check table.setColumns due to an error.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ActiveWidgets Examples</title>

<!-- fix box model in firefox/safari/opera -->
<style type="text/css">
.aw-quirks * {
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}

body {font: 12px Tahoma}
</style>

<!-- include links to the script and stylesheet files -->
<script src="../../runtime/lib/aw.js" type="text/javascript"></script>
<link href="../../runtime/styles/system/aw.css" rel="stylesheet">

<!-- change default styles, set control size and position -->
<style type="text/css">
#myGrid {height: 200px; width: 500px;}
#myGrid .aw-row-selector {text-align: center}

#myGrid .aw-column-0 {width: 80px;}
#myGrid .aw-column-1 {text-align: right;}

#myGrid .aw-grid-row {border-bottom: 1px solid threedlightshadow;}
#myGrid .aw-grid-cell {border-right: 1px solid threedlightshadow;}

/* box model fix for strict doctypes, safari */
.aw-strict #myGrid .aw-grid-cell {padding-right: 3px;}
.aw-strict #myGrid .aw-grid-row {padding-bottom: 3px;}

</style>
<script type="text/javascript">
function addRow(){
//alert();
obj.addRow();
//obj.setColumnIndices([10, 0]);
}
</script>
</head>
<a onclick="addRow()">aaa</a>
<body>
<script type="text/javascript">

// create ActiveWidgets data model - JSON table
var table = new AW.JSON.Table;

// provide data URL
table.setURL("columns.txt");

// specify the rows array property
table.setRows("items");

// specify column properties
table.setColumns(["ticker", "mktcap"]);

// start asynchronous data retrieval
table.request();

// define column labels
var columns = ["Ticker", "Market Cap."];

// create ActiveWidgets Grid javascript object
var obj = new AW.UI.Grid;

// assign unique id for the grid element
obj.setId("myGrid");

// set number of columns
obj.setColumnCount(2);

// provide column labels
obj.setHeaderText(columns);

// enable row selectors
obj.setSelectorVisible(true);
obj.setSelectorText(function(i){return this.getRowPosition(i)});
obj.setSelectorWidth(25);

// set row selection
obj.setSelectionMode("single-row");

// define data formats
var str = new AW.Formats.String;
var num = new AW.Formats.Number;

obj.setCellFormat([str, str, num, num, num]);

// provide external model as a grid data source
obj.setCellModel(table);

// write grid html to the page
document.write(obj);

</script>
</body>
</html>
Saturday, May 17, 2014

This topic is archived.


Back to support forum

Forum search