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

[Solved] Bug in columnShow and columnHide events

1 Answer 162 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ioan Crisan
Top achievements
Rank 1
Ioan Crisan asked on 07 Oct 2014, 12:48 PM
Hi, 
I have a problem regarding the columnShow and columnHide events. Basically, if I will call grid.setDataSource(dataSource) before the _init() method of the Menu class is called, the two events are not issued anymore. Just uncomment the indicated line (24.) in the code sample and watch the browser console: the columnHide event does not get called anymore. The same goes for the columnShow event.

Resolution: In the destroy method of the Menu class, instead of

1.if (that.options.columns && that.owner) {
2.    that.owner.unbind("columnShow", that._updateColumnsMenuHandler);
3.    that.owner.unbind("columnHide", that._updateColumnsMenuHandler);
4.}

change to
1.if (that.options.columns && that.owner && that._updateColumnsMenuHandler) {
2.    that.owner.unbind("columnShow", that._updateColumnsMenuHandler);
3.    that.owner.unbind("columnHide", that._updateColumnsMenuHandler);
4.}

The idea is that the _updateColumnsMenuHandler is undefined at the call time, and all the configured event handlers get unbound.
Could you please provide me a time frame when this fix will be delivered and in which release?

Thanks,
Ioan

Code sample:
01.$("#grid").kendoGrid({
02.  columns: [
03.    { field: "name" },
04.    { field: "age" }
05.  ],
06.  dataSource: [
07.      { name: "Jane Doe", age: 30 }
08.  ],
09.  columnMenu: true,
10.  columnHide: function(e) {
11.    console.log("HIDE " + e.column.field); // displays the field of the hidden column
12.  },
13.  columnShow: function(e) {
14.    console.log("SHOW " + e.column.field); // displays the field of the column made visible
15.  }
16.});
17.var dataSource = new kendo.data.DataSource({
18.  data: [
19.    { name: "John Doe", age: 33 }
20.  ]
21.});
22.var grid = $("#grid").data("kendoGrid");
23.// uncomment the next line
24.//grid.setDataSource(dataSource);

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 08 Oct 2014, 08:40 AM
Hello Ioan,

This is a known issue which has been already addressed. The fix will be included in the Q2 2014 SP2 release of Kendo UI, which should be available in the next couple of days.

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Ioan Crisan
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or