Author Topic: Pass in a JSON object with a class object and use properties as dataIndx  (Read 2427 times)

youngfitz

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 26
    • View Profile
Hi,

I wanted to check if its possible to pass in a JSON object with a class object (TestClass below) and bind the Desc field of this as the dataIndx for the column?
So the property binded to the Column would be TestClass.Desc

     {
      "OrderID": 10702,
      "CustomerName": "ALFKI",
      "EmployeeName": "Peacock",
      "TestClass": {
        "ID": 1,
        "Desc": "Gary"

      }

Thanks,

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Pass in a JSON object with a class object and use properties as dataIndx
« Reply #1 on: September 27, 2018, 06:35:11 pm »
It can be done by hiding TestClass column and adding another formula column to extract value.

Code: [Select]
formula: function( rowData ){
  return rowData.TestClass.Desc
}

youngfitz

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Pass in a JSON object with a class object and use properties as dataIndx
« Reply #2 on: September 27, 2018, 07:25:42 pm »
Thanks for the reply.
Have you a link to a working example of documentation on it?

Thanks,