3 Answers, 1 is accepted
Hi Derian,
The way the data is structured in the provided example is not exactly what the Grid expects to receive as input data. Actually, it is displaying correctly the data provided to its dataSource.
To implement the targeted functionality do display the corresponding text in the Grid's menu we can use the approach discussed in this forum thread. Using the discussed columns.filterable.itemTemplate configuration here is a Dojo that demonstrates the targeted functionality for the 'Brand' column.
To implement the targeted functionality, there is the following definition for the 'Brand' column:
filterable:{
multi:true,
itemTemplate: function(e) {
return "<label><input type='checkbox' name='" + e.field + "' value='#= data.brandId#'/>#= getBrand(brands, data.brandId)#</label><br>" }
}
Where the getBrand function is defined as follows:
function getBrand(arr, brand){
var result;
$.each(arr, function(index, elem){
if(elem.brandId == brand){
result = elem.name;
}
})
if(result == undefined) {
result = "Select all"
};
return result;
}
I hope the provided example will help you implement the targeted functionality in your application.
Regards,
Petar
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).
Hi Derian,
You are welcome! I am happy that the suggested approach has helped you implement the targeted functionality.
Regards,
Petar
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).