[]
Sheets.Bindings.CellBindingSource
• new CellBindingSource(source
)
Represents a source for cell binding.
example
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);
Name | Type | Description |
---|---|---|
source |
Object |
The data source. |
▸ getSource(): Object
Gets the wrapped data source for cell binding.
example
//This example gets the name.
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);
alert(source.getSource().name);
Object
The original data source.
▸ getValue(path
): Object
Gets the value of the source by the binding path.
example
//This example gets the value.
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);
alert(source.getValue("name"));
Name | Type | Description |
---|---|---|
path |
string |
The binding path. |
Object
Returns the value of the binding source at the specified path.
▸ setValue(path
, value
): void
Sets the value of the source by the binding path.
example
//This example sets the name value.
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);
source.setValue("name", "test");
activeSheet.resumePaint();
activeSheet.repaint();
Name | Type | Description |
---|---|---|
path |
string |
The row index. |
value |
Object |
The value to set. |
void