Spread.Sheets Documentation
bindColumns Method
GC.Spread.Sheets Namespace > Worksheet type : bindColumns Method

The following settings available are:

column.name string type The name of the data source column.
column.displayName string type The text to display in the column header.
column.visible boolean type true if the column is visible; otherwise, false.
column.size number type The width of the column.
column.formatter string type The formatter for the column.
column.resizable boolean type true if the column can be resized; otherwise, false.
column.value function type Gets or sets the value to or from the data source for the specified item.
column.cellType GC.Spread.Sheets.BaseCellType type The cell type to display the column cells.
Binds the columns using the specified data fields.
Syntax
var instance = new GC.Spread.Sheets.Worksheet(name);
var value; // Type: any
value = instance.bindColumns(columns);
function bindColumns( 
   columns : Array
) : any;

Parameters

columns

The following settings available are:

column.name string type The name of the data source column.
column.displayName string type The text to display in the column header.
column.visible boolean type true if the column is visible; otherwise, false.
column.size number type The width of the column.
column.formatter string type The formatter for the column.
column.resizable boolean type true if the column can be resized; otherwise, false.
column.value function type Gets or sets the value to or from the data source for the specified item.
column.cellType GC.Spread.Sheets.BaseCellType type The cell type to display the column cells.
Example
This example binds columns.
var datasource = [
                 { name: "Alice", age: 27, birthday: "1985/08/31", position: "PM" },
                 { name: "Aimee", age: 28, birthday: "1984/07/31", position: "TL" },
                 { name: "Charles", age: 29, birthday: "1983/03/31", position: "QC" },
            ];
var colInfos = [
                { name: "name", displayName: "Name", size: 70 },
                { name: "age", displayName: "Age", size: 40, resizable: false },
                { name: "birthday", displayName: "Birthday", formatter: "d/M/yy", size: 120 },
                { name: "position", displayName: "Position", size: 50, visible: false }
            ];
activeSheet.autoGenerateColumns = true;
activeSheet.setDataSource(datasource);
activeSheet.bindColumns(colInfos);
See Also

Reference

Worksheet type
Binding to Data