SpreadJS Documentation
bindColumn Method
GC.Spread.Sheets Namespace > Worksheet type : bindColumn Method
The column index.

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.
Binds the column using the specified data field.
Syntax
var instance = new GC.Spread.Sheets.Worksheet(name);
var value; // Type: any
value = instance.bindColumn(index, column);
function bindColumn( 
   index : number,
   column : undefined
) : any;

Parameters

index
The column index.
column

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.
Example
This example binds specific columns.
var test = [
{"Series0":2,"Series1":1},
{"Series0":4,"Series1":2},
{"Series0":3,"Series1":4}
];
sheet.setDataSource(test);
sheet.bindColumn(1,"Series0");
sheet.bindColumn(0,"Series1");
This example creates a data source and binds specific columns to it.
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" },
                   { name: "Fred", age: 30, birthday: "1982/02/20", position: "DL" },
                   { name: "Angelia", age: 31, birthday: "1981/05/30", position: "QC" },
                   { name: "Peter", age: 32, birthday: "1980/11/08", position: "QC" }
               ];
var nameColInfo = { name: "name", displayName: "Name", size: 70 };
var ageColInfo = { name: "age", displayName: "Age", size: 40, resizable: false };
var birthdayColInfo = { name: "birthday", displayName: "Birthday",formatter:"d/M/yy", size: 120 };
var positionColInfo = { name: "position", displayName: "Position", size: 50, visible: false };
sheet.autoGenerateColumns = true;
sheet.setDataSource(datasource);
sheet.bindColumn(0, nameColInfo);
sheet.bindColumn(1, ageColInfo);
sheet.bindColumn(2, birthdayColInfo);
sheet.bindColumn(3, positionColInfo);
See Also

Reference

Worksheet type
Binding to Data