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

How to keep contents in modal window after clicking anchor tag

4 Answers 62 Views
Window
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 20 Dec 2011, 11:44 PM
I have a modal window containing several anchors. After clicking one of the anchors I need the new content to display in the existing modal window. I have tried several known methods to make this work, but all result in the creation of a new window - as if the target had been set to _top rather than _self. Any guidance is appreciated.

4 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 21 Dec 2011, 10:00 AM
Hi Chris,

It depends on your scenario. Please post the code that creates the window and an example of the window content. Showing your scenario in a jsFiddle will yield the fastest and most accurate answer.

Regards,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Chris
Top achievements
Rank 1
answered on 21 Dec 2011, 04:48 PM
Thanks for the reply. Not sure I can build a test for this in JsFiddle.

I am loading content via ajax into the modal window, and the links in the modal window point to content that will be loaded again using ajax. I've attached a small .png to demonstrate what I am talking about.
0
Accepted
Alex Gyoshev
Telerik team
answered on 21 Dec 2011, 05:05 PM
Hi Chris,

I understand. In this case, you will need to handle all link clicks like this:

    var window = $("#window").kendoWindow();

    window.on("click", "a", function(e) {
        e.preventDefault(); // prevent the link from navigating
        
        window.data("kendoWindow")
            .content("Loading...") // show a loading message
            .refresh($(this).attr("href")); // load the href of the link
    }); 

Best wishes,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Chris
Top achievements
Rank 1
answered on 21 Dec 2011, 10:39 PM
Thank you! That got me half way there and I could figure out the rest. I appreciate the help.

         
Tags
Window
Asked by
Chris
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Chris
Top achievements
Rank 1
Share this question
or