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

[Solved] context menu doesn't apper on an empty fgrid

2 Answers 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roger
Top achievements
Rank 1
Roger asked on 20 May 2008, 02:11 AM
Hi,

I have a context menu attached to a radGrid (V: 2008.1.515.20) using the OnRowContextMenu example given in the Knowledge Base. Everything works fine except for when there are no rows in the grid and I need the context menu to add rows to the grid.

I created another context menu that targets the radGrid and it works fine for the first time the page is loaded but as soon  as the grid is refreshed it doesn't work ( I have a tree that refreshes the grid every time a node is selected - like a file system).

How do I get a context menu to appear every time the grid is clicked, whether it contains rows or not? And why does the second context menu that targets the grid only work once.

Regards
Roger

2 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 23 May 2008, 05:40 AM
Hi Roger,

The OnRowContextMenu client event is fired only when the end user clicks a data row. Therefore when no records are available for the grid, the OnRowContextMenu event isn't fired and the context menu isn't shown.

The solution with adding additional RadContextMenu is an appropriate workaround for your case. Please find attached a sample where the context menu appears always after the grid is refreshed.

Best regards,
Iana
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Roger
Top achievements
Rank 1
answered on 24 May 2008, 12:08 AM
Hi Iana,

thanks for that...I had done all of that but could not get the context menu to show up after selecting a menu item (ie it would only slect 1 then I would get IE's right click menu).

Your sample pointed me in the right direction.

1 of the menu items involved opening a modal radwindow that had a call back function. The purpose of the callback function was to refresh the grid through a RadAjaxManager control. I did have an ajax setting where the grid was updated from the ajaxmanger but not the context menu. When I added the contextmenu to be updated by the ajaxmanger control as well the context menu works every time.

I got this result from looking at your ajaxmanager code.

Thanks
Tags
Grid
Asked by
Roger
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Roger
Top achievements
Rank 1
Share this question
or