Data binding for complex data

Posted by: bemes9226 on 22 July 2021, 2:44 am EST

  • Posted 22 July 2021, 2:44 am EST - Updated 3 October 2022, 4:06 am EST

    Hi Team,

    I have new query .

    data = below template data i have taken,

    but in “template” we have serviceType is number ,actually i want to bind “Types” Name property need to bind, json data.it is a seperate json .

    based on the Template under serviceType as value and Types under Id we need to put condtion true or false.

    if(serviceType === Types.Id)

    this.service.push(Types.Name)

    bind the this.service in grid

    “GetCategorizedWorkFlowTemplatesResult”: {

    “Types”: [

    {

    “Id”: 0,

    “Identity”: “”,

    “Name”: “”

    },

    {

    “Id”: 1,

    “Identity”: “”,

    “Name”: “General”

    }

    ]

    “Templates”:[

    {

    “ClientDisplay”: “”,

    “ServiceType”: 1,

    “Disabled”: false,

    “HasRegion”: false,

    },

    {

    “ClientDisplay”: “reg”,

    “ServiceType”: 1,

    “Disabled”: true,

    “HasRegion”: false,

    },

    }

    ]

    }

  • Posted 22 July 2021, 10:05 pm EST

    Hi,

    To achieve the required functionality you may make use of dataMap property of column as follows -

     <wj-flex-grid-column [header]="'ServiceType'" [binding]="'ServiceType'" [dataMap]="dataMap">
      </wj-flex-grid-column>
    this.dataMap = new wjcGrid.DataMap(
          this.data.GetCategorizedWorkFlowTemplatesResult.Types,
          'Id',
          'Name'
        );
    

    For better understanding, you may refer to the below code sample -

    https://stackblitz.com/edit/json-import-example-jz2gzi?file=src%2Fapp%2Fapp.component.ts

    ~Regards

  • Posted 23 July 2021, 1:13 am EST

    I also would like to know about this data binding. Would you mind to share some more details?

  • Posted 25 July 2021, 4:23 pm EST

    Hi,

    DataMaps are used for mapping column’s cell data. We may use dataMaps in situations when we want to show different values than cell’s actual value. For example, we have an ID column and we want to show Name in the ID column without changing the dataSource.

    For better understanding, you may refer to below reference links -

    https://www.grapecity.com/wijmo/demos/Grid/Columns/DataMaps/angular

    https://www.grapecity.com/wijmo/docs/Topics/Grid/Editing/DataMaps

    https://www.grapecity.com/wijmo/api/classes/wijmo_grid.datamap.html

    ~Regards

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels