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
105
Binding data to dynamic structure
posted

I'm creating columns from a parameter list Paramlist. This Paramlist might have 1 to 999 objects and its composed by a pair.

This paramList is inside another Structure.

Now I'm trying to bind data based on column name which I fetch from ParamList, but the column name (obj) doesn't seems to update when I try to fetch the value. 

// loop uses any paramlist to know how many columns to create

for (var obj in data[0].ParamsList) {
         myHeadersArray[i] = {
              headerText: obj,         // name
              key: "ParamsList",
              dataType: "object",

              formatter: function (val) {

                 return val[obj]; // key, but name(obj) won't refresh and I'm not able to pass it by function parameter
              }
         };
         i++;
}

Example of a pseudo-structure:

[{

     Alias: 'alias1'

     ParamList: [{

            Param1: 'test',

            Param2: 'test2',

       }]

},

{

     Alias: 'alias2'

     ParamList: [{

            Param1: 'test3',

            Param2: '',

       }]

}...]

My problem is similar to this one http://ko.infragistics.com/community/forums/t/72617.aspx 

except that val.Number needs to be val., with obj being dynamic

How can I get the right value?

Excuse my english.

Thank you.

  • 49378
    posted

    Hello Joao,

    Thank you for posting in the community.

    In this scenario, is your aim to display the data from the ParamList pairs as the grid columns ? If that is the case and you have succeeded in doing this, I am assuming the data is being changed externally (without the grid's knowledge or participation) to make it dynamic. Should that be the case, it ought to be possible to display the new data by rebinding the grid to the updated datasource as described at:

    http://ko.infragistics.com/community/forums/t/70293.aspx

     

    Any additional information regarding the scenario in question would be greatly appreciated and would allow me to look into this matter further.