I have a date column in my grid and it works fine. However, I would like to implement the following behavior. Is this possible?
I do not want the user to be able to edit the date via the keyboard. Whenever the user clicks in the cell, I want the calendar to pop up. When a new date is selected, I want it to set the value and not display the text editor.
Any suggestions?
Thanks,
Arthur
Hello Arthur,
Thank you for posting in our community!
I have need a conformation to make sure I have correctly understand your requirement.
A sample presenting how the date picker works is attached. The calendar pops up when the user clicks the cell – as you have required. The user could choose date from the calendar.
However user could also input date manually by the keyboard as the values he enters are validated (he could not enter date as 14/34 for example).
Is it needed to disable the manual input?
Look forwards to hearing from you.
Thank you. What I am looking for is if the user clicks anywhere in the Start Date field, then the calendar popup should appear - not just when the drop down arrow is selected. I want the date in the format "d MMM" and no manual input.
I have attached a sample presenting one possible implementation of your requirements.
Manual input could be removed by handling the keydown event of the date picker and canceling it by the preventDefault() function.
The “onclick” event of the date picker is handled and in its handler function the dropdown is shown.
I have added the code below:
<input id="datePicker" class="datePicker1" type="date" onclick="ShowDropDown()"/>
<script>
$(function () {
$("#datePicker").igDatePicker({
nullText:"",
dateInputFormat: "",
dateDisplayFormat: "d MMM",
keydown: function(evt, ui){
evt.preventDefault();
}
});
function ShowDropDown(){
$("#datePicker").igDatePicker("dropDownVisible", true);
Attached is the whole sample for your reference.
If you have any further questions or concerns don’t hesitate to contact me again.
Hi Dimka, this is an independent datepicker control and when we implement to UpdatingGrid, I still have some issues. I would like to clarify something we need:
- In display mode: Display in format "d MMM": I did, it ok
- In Editing mode (user click to datetimepicker cell):
+ Input is like as read-only (user cannot type)
+ Display in format "d MMM" as above
+ Open DatePicker dialog
+ Dont need show dropdown area in right (due to DatePicker dialog is open when click to cell)
Ngan
Hello Ngan,
In order to get replies more quickly I suggest you to start a new forum thread and not to write in an existing one. To the technical issue – could you provide code snippet or sample and send more details what effect exactly you would like to achieve?