This is a migrated thread and some comments may be shown as answers.

Show columns when we ungroup them

2 Answers 114 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Niloofar
Top achievements
Rank 1
Niloofar asked on 23 Mar 2016, 03:29 PM

I have a grid which i want to hide the columns when they are grouped and show them when are removed from our group panel. is there any other way than looping through all columns to show(commented code). 

                dataBound: function (e) {
                    // this function (event) runs when kendo grid gets new data that get bound
                    var gridDataSource = e.sender.dataSource;
                    if (gridDataSource.group().length > 0) {

                        // for (var i = 0; i < this.columns.length; i++) {
                        //     grid.showColumn(i);
                        // }

                        Ember.$("div.k-group-indicator").each(function (i, v) {
                            e.sender.hideColumn($(v).data("field"));
                        });
                        //the grid is grouped
                        Ember.$(".grouping-collapser").css('display', 'block');
                        e.sender.element.find(".k-icon.k-i-collapse").trigger("click");
                    } else {
                        Ember.$(".grouping-collapser").css('display', 'none');
                    }
                }

2 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 24 Mar 2016, 03:30 PM
Hi Niloofar,

With the current implementation of the widget, traversing the columns and manually hide the grouped ones is the only available option. If you thing that such feature could be a good addition to the built-in functionality of the widget you could create a feature request in our public portal:


Best Regards,
Konstantin Dikov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Niloofar
Top achievements
Rank 1
answered on 24 Mar 2016, 06:04 PM
Thank you for your reply,  I will.
Tags
Grid
Asked by
Niloofar
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Niloofar
Top achievements
Rank 1
Share this question
or