pageForm.viewModel set ScheduledStartDate
I've added a customization to the SR form and it sets the ScheduledStartDate using the following:
dateValue="2018-08-17T14:00:00" // this is actually computed based on the current date, but I've hardcoded to simplify
pageForm.viewModel.set("ScheduledStartDate", dateValue)
but the "Scheduled Start Date" field on the form stays blank. If I hit apply the SR reloads and the scheduled start date is populated so its saving just fine, but I'd like it to update the field on the form.
Is there a trick to forcing the date field on the form after the viewModel is updated ?
Best Answer
-
Geoff_Ross Cireson Consultant O.G.If you use the set() method in the viewModel, in most cases this will update both the model and the form.
egpageForm.viewModel.set('Title','this is the new title!');
will update the form and the model.
However, I recently run into this problem too as this does not work for date fields. In the case, as Jeff said, you need to update the actual html element. We can at least use the kendo.toString() method to format our date as per user's date format preferences.var now = new Date() pageForm.viewModel.set('ReceivedDate',(new Date()).toISOString()); $('[name="ReceivedDate"]').val(kendo.toString(now, "d"))
Geoff6
Answers
eg
will update the form and the model.
However, I recently run into this problem too as this does not work for date fields. In the case, as Jeff said, you need to update the actual html element. We can at least use the kendo.toString() method to format our date as per user's date format preferences.
Geoff