It will be great if we can have a very simple "out-of-the-box" way to add a Column Chooser in the toolbar, similar to the Search Feature.
Something like Syncfusion's column chooser here:
https://ej2.syncfusion.com/aspnetcore/Grid/ColumnChooser
This will help me significantly in my development effort and provide a much better experience for my paying customers.
I have hundreds of grid tables with different schemas, columns with MinScreenWidth, and hidden columns (depending on the availability of data).
On a page, it can have multiple grid tables that are dynamically generated.
I also use View Component to generate each grid table.
The current column menu isn't perfect because I want it to only act as a filter checkbox, not a menu where a user needs to click twice to access the filtering feature. (And my users need to use the filtering mechanism A LOT)
Thanks,
Luke
Hello Luke,
Thank you for your feedback.
I have upvoted this Feature Request on your behalf. As we actively monitor the community interest in requested features to determine which to implement in the future.
Currently we have a Knowledge Base article that showcases how to create an external columns menu with checkbox functionality outside to the Kendo UI Grid. As workaround I suggest the following approach that is based on the article above and utilizes the Grid's showColumn and hideColumn methods.
$(document).ready(function () {
var grid = $("#grid").data("kendoGrid");
var columnValues = grid.columns;
var numOfColumns = grid.columns.length;
columnValues.forEach(column => {
$("#columnChooser").append(`<span class='${column.field} p-2'></span>`)
$(`.${column.field}`).append(`<label for="${column.field}">${column.title}</label>`)
$(`.${column.field}`).append(`<input id="${column.field}" type="checkbox" checked=true>`)
$(`#${column.field}`).on("input", function (e) {
if ($(`#${e.currentTarget.id}`).prop("checked")) {
grid.showColumn(e.currentTarget.id)
numOfColumns++;
} else {
if (numOfColumns > 1) {
numOfColumns--;
grid.hideColumn(e.currentTarget.id)
} else {
$(`#${e.currentTarget.id}`).prop("checked", true)
}
}
})
})
})
I hope the above is helpful in the current scenario. Please don't hesitate to contact me, should additional questions occur.
Regards,
Stoyan
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.