jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Reset jqxDateTimeInput
Tagged: date editor
This topic contains 6 replies, has 2 voices, and was last updated by Peter Stoev 11 years, 10 months ago.
-
AuthorReset jqxDateTimeInput Posts
-
Am using a jqxgrid where jqxDateTimeInput is used. on click of a button i will save the date selected to DB. but once i select, there is no option to clear it. suppose i enter dates and and now i dont want to save it to DB there is no way. Can you please let me know is there a way to clear the selected date?.
Hi Akshar AK,
To clear the selected data, when you open the editor, set the “initeditor” callback function of the column and then call the jqxDateTimeInput’s “setDate” method with parameter null.
{ text: 'Date', datafield: 'date', width: 70, cellsalign: 'right', columntype: 'datetimeinput', initeditor: function (row, cellvalue, editor) { editor.jqxDateTimeInput('setDate', null); }}
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/hello Peter Stoev,
right now my column is like below{ text : 'Start Date', id: 'startDatePopUp',datafield : 'startDate', columntype: 'datetimeinput', cellsformat: 'MMM yyyy', align : 'center', width : 150, cellsalign : 'center', validation: function (cell, value) { var flag = dateValidation(cell,value,"Start Date"); return flag; }, initeditor: function (row, cellvalue, editor) { editor.jqxDateTimeInput('setDate', new Date()); } }
am able to select the date. suppose i select a date and then i want that column to be blank and select the date and hit delete button, default date ‘Jan 1970’ is selected. but there is no option where i can remove the date once i selected. refreshing the page without saving is the only option i have.
Please do reply. Am waiting for your reply…
Hi Akshar AK,
In the current version, when you press DEL, the Date is cleared – see: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/cellediting.htm?web
Your code: editor.jqxDateTimeInput(‘setDate’, new Date()); initializes the widget with the current Date. If you want it to be initialized as null, pass null as parameter. To delete the date it is not necessary to be in edit mode, too. Just select the cell and press DEL.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Thanks for the update Peter,
But if i use the entire versions of JQWidget then my code is not working. But if i replace only ‘jqxdatetimeinput.js’ then a java script error saying ‘isHidden is undefined’. Is there any way to change or upgrade only ‘jqxdatetimeinput.js’ without affecting the other parts of the code?Hi Akshar AK,
‘isHidden’ is part of jqxCore. I suggest you to migrate to a new version if that is possible and update your code accordingly. You can find the breaking changes in the Documentation’s Release History or in ReleaseNotes.txt which is included in the download package.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.