# GC.Spread.Sheets.Bindings.CellBindingSource

## Content

# Class: CellBindingSource

[Sheets](../modules/GC.Spread.Sheets).[Bindings](../modules/GC.Spread.Sheets.Bindings).CellBindingSource

## Table of contents

### Constructors

- [constructor](GC.Spread.Sheets.Bindings.CellBindingSource#constructor)

### Methods

- [getSource](GC.Spread.Sheets.Bindings.CellBindingSource#getsource)
- [getValue](GC.Spread.Sheets.Bindings.CellBindingSource#getvalue)
- [setValue](GC.Spread.Sheets.Bindings.CellBindingSource#setvalue)

## Constructors

### <a id="constructor" name="constructor"></a> 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

### <a id="getsource" name="getsource"></a> 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.

___

### <a id="getvalue" name="getvalue"></a> 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.

___

### <a id="setvalue" name="setvalue"></a> 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`
