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

Make toolbar create link work when grid is not visible

2 Answers 159 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 06 Jan 2014, 03:20 PM
I have a search screen that takes up a fair amount of real estate.  When you click search, the search options compress into an accordian like control, and the Kendo grid is shown.  On the grid is a toolbar with a create button.

Now, say there are no results returned from the search.  I do not show the Kendo grid, but it is rendered.  The display is simply set to none.  In my Razor at this point, I add a create button at the bottom of my search criteria boxes.  Some red text indicates that no records were found.  The reason that I do not show the grid and instead keep the search criteria in full view is so the user can easily do another search.

The create button that gets added steals the anchor URL from the Kendo grid's toolbar's create button on the page.  Clicking it does nothing though.  Making the blank grid visible causes this link to start working.

So why would the grid display attribute cause the create button to not work?  The create uses a popup window if that matters.

2 Answers, 1 is accepted

Sort by
0
Paul
Top achievements
Rank 1
answered on 06 Jan 2014, 04:38 PM
Update - I solved this issue by making two changes to the Kendo source code.  Though I really don't like changing this because it will cause issues with updates, or possibly other issues with Kendo source code in other places.  If there's a better way to achieve this, please let me know.

In kendo.window.js, I changed (marked lines below):
if (!element.parent().is(that.appendTo) && (options.position.top === undefined || options.position.left === undefined)) {
   if (element.is(VISIBLE)) {
      offset = element.offset();
      isVisible = true;
   } else {
      visibility = element.css("visibility");
      display = element.css("display");
 
      element.css({ visibility: HIDDEN, display: "" });
      offset = element.offset();
      element.css({ visibility: visibility, display: display });
 
      isVisible = true; // ADDED NEW LINE
   }
}
 
if (!defined(options.visible) || options.visible === null) {
   //options.visible = element.is(VISIBLE); // CHANGED LINE
   options.visible = true; // CHANGED LINE
}
0
Alexander Popov
Telerik team
answered on 07 Jan 2014, 01:49 PM
Hi Paul,

I tried to reproduce this behavior here, but to no avail - the editing popup is displayed regardless of the fact that the Grid is wrapped in a div with display property set to none. Perhaps my setup is different from yours, so I would ask you to provide a small example that reproduces the issue. This will allow us to see where the issue originates from and advise you further.

Regards,
Alexander Popov
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
Paul
Top achievements
Rank 1
Answers by
Paul
Top achievements
Rank 1
Alexander Popov
Telerik team
Share this question
or