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

RadGrid FilterMenu causing javascript error, not sure if it is a bug

1 Answer 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 08 Sep 2014, 03:25 PM
2014.2.724.45
When in Grid Init event:
GridID.FilterMenu.Items.Clear()

With filtering active on a column, clicking the filter button generates this javascript error:

Uncaught TypeError: Cannot read property `_linkElement` of undefined

Referring to this code:
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.GridColumn=function(a){Telerik.Web.UI.GridColumn.initializeBase(this,[a]);
.....
var h=this._filterMenu.get_focusedItem()||this._filterMenu.get_items().getItem(0);
if(h._linkElement){h._linkElement.focus();  <-- err line. 6623
}else{if(h._templateElement){h._templateElement.focus();

The line above does not appear in the the version 2014.1.403.45 nor does the same error happen.

I have to add 
<ClientEvents OnFilterMenuShowing="RadGrid_DisableFilterMenu" />

function RadGrid_DisableFilterMenu(sender, args) {
  args.set_cancel(true)
}

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 11 Sep 2014, 10:44 AM
Hello Peter,

The behavior that you are describing is due to the fact that the FilterMenu must have at least one element. As you can see in the line above the one throwing the error, when the menu is opened, the first item is retrieved with "filterMenu.get_items().getItem(0)". Since further logic depends on that item, when you remove all items from the FilterMenu, that logic will fail. 

Generally, there are no use cases when you will need a filter menu and have no items, so that is the reason for not checking the length of the items collection.

Hope this helps.


Best Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Peter
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or