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 GcSpread.Sheets.CellBindingSource before binding the cell. Then bind the wrapped source to the sheet (sheet.setDataSource).
This example binds cells in the sheet.
JavaScript |
Copy Code
|
---|---|
var person = {name: "Wang feng", age: 25, address: {postcode: "710075"}}; var source = new GcSpread.Sheets.CellBindingSource(person); activeSheet.setBindingPath(0, 0, "name"); activeSheet.setBindingPath(1, 1, "age"); activeSheet.setBindingPath(3, 3, "address.postcode"); activeSheet.setDataSource(source); |