# DataExchange

- Index
- Sigma
- Sigma.Grid
- Sigma.Column
- Sigma.Column.Editor
- Sigma.DataSet
- Sigma.DataSet.field
- Sigma.Grid.PageInfo
- Sigma.Grid.SortInfo
- Sigma.Grid.FilterInfo
- Sigma.Grid.Event
- Sigma.Grid.EventTarget
- DataExchange

## Data Schema

Loading Data

### This section defines json format when grid is loading data from server side.

#### Json format of data from grid to server side. Here is a sample of Json string grid posts to server.

    {
      "action":"load",
      "pageInfo":{
        "pageSize":10,
        "pageNum":2,
        "totalRowNum":31,
        "totalPageNum":4,
        "startRowNum":11,
        "endRowNum":20
      },
      "sortInfo":[{
        "columnId":"country",
        "fieldName":"country",
        "sortstate":"asc"
        }],
      "filterInfo":[{
        "columnId":"order_no",
        "fieldName":"order_no",
        "logic":"equal",
        "value":"12345"
      }],
      "parameters":{}
    }

#### Notes

action: String. Alway be "load".
pageInfo: See Sigma.Grid.PageInfo object.
sortInfo: See Sigma.Grid.SortInfo object.
filterInfo: See Sigma.Grid.FilterInfo object.
parameters: Parameters user adds. See Sigma.Grid.addParameters

#### Json format of data from server side to grid.

    {
      data:[
        ["24","CA","Le","Caspar","62","94","53","88","2008-03-18 00:00:00"],
        ["25","SP","Ju","Joe","38","97","35","74","2008-07-31 00:00:00"],
        ["26","UK","Co","Thomas","55","58","62","46","2008-07-19 00:00:00"]
      ],
      pageInfo:{totalRowNum:31},
      recordType : 'array'
    }

#### Notes

data: Data content.
pageInfo: See Sigma.Grid.PageInfo object.
recordType: Type of data. Could be "array" or "object".
Saving Data

### This section defines json format when grid is saveing data to server side.

#### Json format of data from grid to server side.

    {
      action : 'save',
      fieldsName : [..],
      insertedRecords : [..],
      updatedRecords : [..],
      deletedRecords : [..],
      recordType : "object"/"array",
      parameters : {}
    }

#### Notes

action: String. Alway be "save".
fieldsName: Array. Fields name
insertedRecords : Array of array/object. Records inserted by user.
updatedRecords : Array of array/object. Records updated by user.
deletedRecords : Array of array/object. Records deleted by user.
recordType: Type of insertedRecords, updatedRecords, deletedRecords. Could be "array" or "object".
parameters: Parameters user adds. See Sigma.Grid.addParameters

#### Json format of data from server side to grid.

    {
      success : true/false,
      exception : "..."
    }

#### Notes

success: Bool. To specify whether CRUD operation is successful.
exception: Exception/error message.