Categories | Question details Back To List | ||
Calendar Hi i am using the calendar column and have a couple of questions: 1) how can i change it to display the European format dd/mm/yyyy 2) once someone has choose a date the field is set to the date but i want the user to be able to set it back to nothing if they wish, how do i do this thanks very much Answer posted by Stanislav on Nov 26, 2007 02:55 how can i change it to display the European format dd/mm/yyyy
If you are using "calendar" or "dhxCalendar" column type , the format of date can be set by grid.setDateFormat("d/m/y"); // this is for calendar excell, for dhxCalendar - please check documentation of dhtmlxCalendar once someone has choose a date the field is set to the date but i want the user to be able to set it back The calendar itself has not button for value clearing, but you can assign such operation for any custom button, or hotkey, for example next code attach "clear cell" functionality to "del" key. mygrid.attachEvent("onKeyPress",function(key){ if (key=-46){ if (!this.editor) this.cells4(this.cell).setValue(""); } return true; }); Answer posted by Richard White on Nov 26, 2007 15:32 Hi this works great except i have 22 columns in my grid but i only want it to set the calendar columns to "" if they press the delete key. i cannot work out from the code you gave me how i could identify the column index and the selected row of the cell that was clicked is there a way i can do this? thanks Answer posted on Nov 27, 2007 03:26 You can use getSelectedCellIndex to detect selected column mygrid.attachEvent("onKeyPress",function(key){ if (key=-46 && this.getSelectedCellIndex()==21){ if (!this.editor) this.cells4(this.cell).setValue(""); } return true; }); Answer posted by richard white on Nov 27, 2007 04:53 perfect thanks - also i have noticed that when i use the setdateformat(d/m/y) it does display the correct format in dd/mm/yyyy but when i .getValue() the data then it returns the date still as mm/dd/yyyy is this a bug or do i have to do something else to get it in the format dd/mm/yyyy thanks Answer posted by Stanislav on Nov 27, 2007 07:12 >>also i have noticed that when i use the setdateformat(d/m/y) Actually it is kind of "feature", because to process date correctly it still need to be in javascript compatible format, so while showing it in custom formated state grid still use native format for all inner operation. If you need rendered value, you can access rendered html in cell as grid.cells(i,j).cell.innerHTML |