SpreadJS Documentation
Binding Cells
SpreadJS Documentation > Developer's Guide > Managing Data > Binding to Data > Binding Cells

You can use cell-level binding in SpreadJS.

Cell-level binding binds an object's property to a sheet cell. Wrap the data object to GC.Spread.Sheets.Bindings.CellBindingSource before binding the cell. Then bind the wrapped source to the sheet (sheet.setDataSource).

Using Code

This example binds cells in the sheet.

JavaScript
Copy Code
var person = {name: "Wang feng", age: 25, address: {postcode: "710075"}};
var source = new GC.Spread.Sheets.Bindings.CellBindingSource(person);
activeSheet.setBindingPath(0, 0, "name");
activeSheet.setBindingPath(1, 1, "age");
activeSheet.setBindingPath(3, 3, "address.postcode");
activeSheet.setDataSource(source);
See Also