How to re - rendering date picker - ajax

How to render an existing jquery datePicker based upon new values upon ajax post? And how do I change the start date of display based upon a particular date in the ajax post

Fire a function, that generates the date picker, when the ajax response is ready.
jQuery date picker has option defaultDate, which You can also change, when rendering new version of date picker.

Related

Kendo MVC with Inline Editing Default Datetime of DateTime.Now showing page refresh time

I have a Kendo MVC Grid that uses Inline editing. When I click "Add New Record" it is supposed to default the entry to DateTime.Now. The issue is that this value doesn't update, it continues to show the time the page was loaded instead of the time when the row is added.
I have tried to set it in the editor template and the model and I am getting the same result. My guess is I would have to set the javascript but cant find how to do this with inline fields and select the right DateTimePicker to update the value on. How can I have this default value be set when the add new record button is clicked.
When you set the DefaultValue in the DataSource Model definition the DateTime.Now value will get serialized as part of the initialization script.
If you need this to by dynamic you can add an Edit event handler and check if the model instance edited is a newly created one. If so set the date field to the current date and time:
function onEdit(e){
if(e.model.isNew()){
e.model.set("MyDateField",new Date());
}
}
Here is an example.

Bootstrap Modal Form validation on submit deleting ajax data showen inside modal

This is my bootstrap modal form, the from date and to date data I am passing data-*
The issue is when I submit the form without any input the validation works but the from date and to date disappears

Windows Phone Date Picker Submit event

I have a native Date Picker in a windows phone app.
Using the DateChanged event I can perform actions when the user submits.
DatePicker.DateChanged += (o, args) =>
{
var date = args.NewDate;
// Do something with it
}
The problem I am facing is the event is not triggered if the user submits the date picker without changing the date.
Default value is set to today's date which makes it impossible to select this date.
Does anyone know how I can allow the user the select this date and perform actions after ?
Thanks for your help :)
There is no particular way of getting an event fired when the date is not changed. As you said the date picker by default selects the current date, you can perform the action you want to if the user selects today's date in the OnNavigatedTo, Loaded, or DatePicker_Loaded event. A better way to do so is providing the DatePicker an invalid date something like 1Jan1947, this ways the user has to change the date else it'll be invalid. Also if you write the code you want on dateChanged event, it'll fire automatically as when the DatePicker is Loaded it sets the date from default to the current date.
What I would recommend
is to use a binding property to hold a value and then performing the
operations onPropertyChanged event of that property. This ways your
logic is independent of your datePicker and you could write events
for each time the dateTime property changes.
Do remember to bind the datePicker's date property to the DateTime
property in a TwoWay Mode and an UpdateSourceTrigger of
PropertyChanged. This ways when you change the property from code
behind the data would reflect in the datePicker and when you change
the value in the datePicker, the data would be reflected in the code
behind as well

Manual input date in Kendo Grid DatePicker not working

I'm facing a problem that I can't understand. I'm using Kendo Grid with InCell edit and I have a DateTime field in my Model.
When the grid enters in edit mode, the calendar is shown, but the grid only saves the inputed value if I select the value from the calendar. If I input the field manually, the value is not saved and the cell is not marked has dirty.
If it helps, I'm using MVC with Razor sintax.
Tks in advance!
I've found a workaround in Kendo's forums:
By design, the DatePicker does not raise the change event when the value is set programmatically - it raises only if the date is modified by the end-user. In case you need to trigger the change event, you can use jQuery trigger().
For example:
var datePicker = $("#datepicker").data("kendoDatePicker");
datePicker.value("01/01/2001");
datePicker.trigger("change");
Reference:
http://www.kendoui.com/forums/ui/date-time-pickers/datepicker-change-event.aspx
So basically what I did was to force the change event manually.

grails datepicker value via ajax

How can I set an onchange event to a tag?
I want to transfer the new value to the server without klicking the submit button (therefore in an ajax way)
Grails datepicker tag implemention renders a fixed number of select tags based on the precision that you choose. However, no onchange attribute is added to any of these select tags. The id of each select tag is the id that you specify in the datepicker tag appended by the type of data that each select shows. Eg. the select box for day has id "yourDatepickerTagId_day", the month select tag has id "yourDatepickerTagId_month" etc. To bind the "change" event to any of these select tags you will have to use some custom javascript to handle these events. If you use jQuery, you can use something like this:
$(document).ready(function(){
$("select[id ^= yourDatepickerTagId]").change(function (){
// Do your stuff here...
});
});

Resources