Kendo UI Window - Prevents Download of Previous Content

I use Kendo Window in my MVC project.

This is how I run an object from a view

@(Html.Kendo().Window()
    .Name("window")
    .Content("loading page..")
    .Iframe(true)
    .Draggable()
    .Visible(false)
    .Height(200)
    .Width(400)
    .Modal(true)
)



and so I call the window using javaScript where _url is dynamic

$('#window')
   .data("kendoWindow")
   .title("Add new category")
   .refresh({
       url: _url
   })
   .center()
   .open();


My problem is that whenever I open the window a second time, it still displays the previous content until it finishes loading the current one.

I try to hide the content first using this:

$('#window')
     .kendoWindow({
         visible: false
     })
     .data("kendoWindow")
     .title("Add new category")
     .refresh({
         url: _url
     })
     .center()
     .open();

but the object seems to be destroyed when I try to close it.

+4
source share
2 answers

Use this:

$('#window')
   .data("kendoWindow")
   .title("Add new category")
   .content("") //this little thing does magic 
   .refresh({
      url: _url
   })
   .center()
   .open();

I would advise you to reorder your calls:

 $('#window')
   .data("kendoWindow")
   .title("Add new category")
   //.content("") //this little thing does magic 
   .content("<img src='ajax-loader.gif' alt='Loading...'/>")
   .center()
   .open();
   .refresh({
      url: _url
   })

, , . ( ), Kendo AJAX, refresh.

close content("") .

+12

.Events(e =>
{
    e.Refresh("onRefresh");
})

<script>
    function onRefresh() {
        this.center();
    }
<script>

, .

( )

0

Source: https://habr.com/ru/post/1533351/


All Articles