Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
125
Grid remote datasource mapping with function
posted

Is there a way for one to map data from a remote datasource using a function? For example consider the following column structure -

columns: [
{ headerText: "ID", key: "id", dataType: "number", width: "50px" },
{ headerText: "Name", key: "name", dataType: "string", width: "125px" },
{ headerText: "apartment", key: "", dataType: "string", width: "125px" },

{ headerText: "homephone", key: "", dataType: "string", width: "125px" },

{ headerText: "cellphone", key: "", dataType: "string", width: "125px" },

]

Now consider the following JSON response -

[{

      id"546df5a6bb1a4fde4508a13d

     name"Bob"

     details: [{

         type: "address",

         moredetails: {

         apartment: 900,

        street: "Bay"

         } ,

         {

         type: "phone",

         moredetails: {

         home: 900455213,

         cell: 500987276

         } 

    }]

}]

I wish to map the cellphone, homephone and apartment columns using conditional mapping so that the key would depend on the 'type' of a specific detail. How can i do this?