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

MVVM Updating Screen

3 Answers 57 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 16 Jan 2020, 07:33 PM

I have a SignalR process feeding updates to a viewModel using Kendo's observable.  Everything is working was expected, but I needed to add a confirm popup for the user, and now it's not working as I expect it to.  The singlaR process gets a specific value, in which case I update the javascript viewModel and ask the user a question via the javascript confirm function.  What's happening is the updated viewmodel values aren't displaying on the screen until after the user answers the confirm.  I expected the values on the screen to update before the confirm pops up, but that's not happening.  How can I make it do so?

 

status.on("sendGTNProgress", function (theStats) {
  var statObj = JSON.parse(theStats);
 
  if (statObj.ProcessMessage === "FILE READY") {
    viewModel.set("processMessage", "GTN Report Generated and Ready for Download");
    viewModel.set("processName", "File Name: " + statObj.ProcessName);
    viewModel.set("currentRecMsg", "Your report file is in the appropriate network directory");
    viewModel.set("progressMsg", "@ConfigurationManager.AppSettings["ReportDir"]");
 
    AskToDownload();
  }

});

 
function AskToDownload() {
if (confirm("Do you want to download this file locally?")) {
  window.open("@Url.Action("GetGTNFile", @"GTNReport")?theFile=" + viewModel.get("processName").replace("File Name: ", ""), "_blank");
  }
}

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 20 Jan 2020, 11:50 AM

Hello,

Thank you for getting in touch with us.

From the information provided it is not quite clear what is not working correctly. In the general case with Kendo MVVM the code is working correctly as for example it can be observed in this dojo example. Please review it and let me know if this could be updated somehow to be able to observe the issue locally and be more helpful with a possible solution.

Regards,
Plamen
Progress Telerik

Get quickly onboarded and successful with your Telerik UI for ASP.NET MVC with the dedicated Virtual Classroom technical training, available to all active customers.
0
Joe
Top achievements
Rank 1
answered on 20 Jan 2020, 02:21 PM
What I'm saying is the confirm popup pops up before the actual value on the screen changes.  Using your own dojo example https://dojo.telerik.com/EPOYiles demonstrates this...  What I want is the viewModel values to be updated on the screen BEFORE the confirm popup pops up.
0
Plamen
Telerik team
answered on 21 Jan 2020, 12:58 PM

Hi,

Thank you for elaborating the issue and please excuse me for not being able to help you straight away. In such case if you want to have the page updated you will have to use another setTimeout to use the confirm as for example it is done here - https://dojo.telerik.com/@zdravkov/aPAvEYif/2

Regards,
Plamen
Progress Telerik

Get quickly onboarded and successful with your Telerik UI for ASP.NET MVC with the dedicated Virtual Classroom technical training, available to all active customers.
Tags
General Discussions
Asked by
Joe
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Joe
Top achievements
Rank 1
Share this question
or