Hello!
The new igGrid object mapper in version 2016.1 is a nice feature.
But i'm a little bit disappointed, that the MVC wrapper doesn't support it. Are there any plans to add this feature?
In the meantime i started to instantiate my grids in JavaScript. I set one column to object and defined a mapper function. Worked well.
After that i wanted to define a second object column. to get a second property from the same object. This doesn't worked for me, because i had to set as key the same property name of the object. Result was two identical columns, because the grid used only the last one.
You can reproduce this if you just add a line in your sample project, page "handling-complex-objects.html".
column definition example:
{ headerText: "Category", key: "Category", dataType: "object", mapper: function (record) { return record.Category.Name; } }, { headerText: "CategoryId", key: "Category", dataType: "object", mapper: function(record) { return record.Category.ID; } }
Hello soum,
Please note that column keys should be unique. In your case you're using the same column key ("property3") in two different columns and therefore the second one doesn't work properly. If you want to use object mapper for two columns with same data, I suggest you to define two objects in your datasource with same data, but different keys, for example:
records:[
{property1:"valueProperty1",
property2:"valueProperty2",
property3: {
subProperty3_1:"subValueProperty3_1",
subProperty3_2:"subValueProperty3_2"
......
},
property4: {
}
}]
Regards,
Tsanna
my dataSource is like this:
In my grid i display the different column with this code (is work perfect)
columns: [ { headerText: "property1", dataType: "string", key: "property1" }, { headerText: "property2", key: "property2", dataType: "string" },
{ headerText: "property3", key: "property3", dataType: "object", mapper: function(record){
return record.property3.subProperty3_1
} },
]
but when i add a over cover like this
columns: [{ headerText: "property1", dataType: "string", key: "property1" },{ headerText: "property2", key: "property2", dataType: "string" },
{ headerText: "property4", key: "property3", dataType: "object", mapper: function(record){
return record.property3.subProperty3_2
} }
the value of the column "property3" is erase by the value of column "property4"
Soum,
Yes the update would have been present in 17.1. If you are having an issue with 17.1 please start a new thread with enough details about how to recreate the issue and we will look into it.
currently i'm using vereion 17.1 so i guess this update is present
The solution to this was to get the update that we released last year. Have you done that?