SpreadJS Documentation
addFromDataSource Method
GC.Spread.Sheets.Tables Namespace > TableManager type : addFromDataSource Method
The table name.
The row index.
The column index.
The data source for the table.
The style of the table.
The initialization options of the table.
Adds a range table with a specified data source to the sheet.
Syntax
var instance = new GC.Spread.Sheets.Tables.TableManager(sheet);
var value; // Type: any
value = instance.addFromDataSource(name, row, column, dataSource, style, options);
function addFromDataSource( 
   name : string,
   row : number,
   column : number,
   dataSource : object,
   style : TableTheme,
   options : Object
) : any;

Parameters

name
The table name.
row
The row index.
column
The column index.
dataSource
The data source for the table.
style
The style of the table.
options
The initialization options of the table.
Example
This example creates a table.
var source = [
                { LastName: "Freehafer", FirstName: "Nancy", Title: "Sales Representative", Phone: "(123)555-0100"},
                { LastName: "Cencini", FirstName: "Andrew", Title: "Vice President, Sales", Phone: "(123)555-0101"},
                { LastName: "Kotas", FirstName: "Jan", Title: "Sales Representative", Phone: "(123)555-0102"},
                { LastName: "Sergienko", FirstName: "Mariya", Title: "Sales Representative", Phone: "(123)555-0103"},
            ];
            
            activeSheet.tables.addFromDataSource("Table1", 5, 2, source, GC.Spread.Sheets.Tables.TableThemes.dark1);
See Also

Reference

TableManager type
Creating Tables