[]
        
(Showing Draft Content)

GC.Spread.Sheets.Bindings.CellBindingSource

Class: CellBindingSource

Sheets.Bindings.CellBindingSource

Table of contents

Constructors

Methods

Constructors

constructor

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);

Parameters

Name Type Description
source Object The data source.

Methods

getSource

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);

Returns

Object

The original data source.


getValue

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"));

Parameters

Name Type Description
path string The binding path.

Returns

Object

Returns the value of the binding source at the specified path.


setValue

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();

Parameters

Name Type Description
path string The row index.
value Object The value to set.

Returns

void