Sherzod Posted September 21, 2015 Share Posted September 21, 2015 Dear Friends, A simple example of implementation DateTimepicker for Sencha Touch: Source: https://github.com/tomalex0/senchatouch-datetimepickerv2 Demo: http://tomalex0.github.com/senchatouch-datetimepickerv2 How to use: 1. Download the following files and add these files to the directory "/files": https://raw.githubusercontent.com/tomalex0/senchatouch-datetimepickerv2/master/ux/DateTime.js https://raw.githubusercontent.com/tomalex0/senchatouch-datetimepickerv2/master/ux/DateTimePicker.js 2. and add these files to your project (CustomFiles...): files/DateTime.js files/DateTimePicker.js 3. UnimDatePicker1.DateFormat := "dd/MM/yyyy H:i" 4. UnimDatePicker1 -> ClientEvents -> UniEvents .. beforeInit fn: function beforeInit(sender, config) { config.picker = Ext.create('Ext.ux.picker.DateTime', { useTitles: false, doneButton: true, cancelButton: true, minuteInterval : 1, //slotOrder: ['month', 'day', 'year','hour','minute'], toolbar: { //items : datetimepickettoolbaritems } }); } It can also be applied to UnimDBDatePicker (as in the screenshot)... Try, Best regards. 1 Link to comment Share on other sites More sharing options...
billyChou Posted September 21, 2015 Share Posted September 21, 2015 Thanks Link to comment Share on other sites More sharing options...
stiaan Posted September 21, 2015 Share Posted September 21, 2015 Thanks! Good info! Link to comment Share on other sites More sharing options...
LordDelphi Posted January 30, 2017 Share Posted January 30, 2017 Thanks! Link to comment Share on other sites More sharing options...
Aar0n Posted March 6, 2017 Share Posted March 6, 2017 after setting date and time: How can I read the datetime information? Link to comment Share on other sites More sharing options...
Sherzod Posted March 6, 2017 Author Share Posted March 6, 2017 Hi, Try this: ... 1. UnimDatePicker1 -> ClientEvents -> UniEvents .. beforeInit fn: function beforeInit(sender, config) { config.picker = Ext.create('Ext.ux.picker.DateTime', { useTitles: false, doneButton: true, cancelButton: true, minuteInterval : 1, //slotOrder: ['month', 'day', 'year','hour','minute'], toolbar: { //items : datetimepickettoolbaritems } }); Ext.Date.patterns={CustomFormat: "d/m/Y H:i"}; // <------------ } 2. UnimDatePicker1 -> ClientEvents -> ExtEvents -> function change: function change(sender, newDate, oldDate, eOpts) { ajaxRequest(sender, '_dateChange', ['val='+Ext.Date.format(newDate, Ext.Date.patterns.CustomFormat)]) } 3. UnimDatePicker1 -> OnAjaxEvent: procedure TMainmForm.UnimDatePicker1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); var newDateTime : TDateTime; Fmt: TFormatSettings; begin if EventName = '_dateChange' then begin Fmt.ShortDateFormat:='dd/mm/yyyy'; Fmt.DateSeparator :='/'; Fmt.LongTimeFormat :='hh:mm'; Fmt.TimeSeparator :=':'; newDateTime := StrToDateTime(Params.Values['val'], Fmt); //ShowMessage(DateTimeToStr(newDateTime)); end; end; Best regards. Link to comment Share on other sites More sharing options...
Aar0n Posted March 7, 2017 Share Posted March 7, 2017 Hi, Try this: ... 1. UnimDatePicker1 -> ClientEvents -> UniEvents .. beforeInit fn: function beforeInit(sender, config) { config.picker = Ext.create('Ext.ux.picker.DateTime', { useTitles: false, doneButton: true, cancelButton: true, minuteInterval : 1, //slotOrder: ['month', 'day', 'year','hour','minute'], toolbar: { //items : datetimepickettoolbaritems } }); Ext.Date.patterns={CustomFormat: "d/m/Y H:i"}; // <------------ } 2. UnimDatePicker1 -> ClientEvents -> ExtEvents -> function change: function change(sender, newDate, oldDate, eOpts) { ajaxRequest(sender, '_dateChange', ['val='+Ext.Date.format(newDate, Ext.Date.patterns.CustomFormat)]) } 3. UnimDatePicker1 -> OnAjaxEvent: procedure TMainmForm.UnimDatePicker1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); var newDateTime : TDateTime; Fmt: TFormatSettings; begin if EventName = '_dateChange' then begin Fmt.ShortDateFormat:='dd/mm/yyyy'; Fmt.DateSeparator :='/'; Fmt.LongTimeFormat :='hh:mm'; Fmt.TimeSeparator :=':'; newDateTime := StrToDateTime(Params.Values['val'], Fmt); //ShowMessage(DateTimeToStr(newDateTime)); end; end; Best regards. Thank you so much! Link to comment Share on other sites More sharing options...
KingOrmon Posted June 23, 2022 Share Posted June 23, 2022 Hi, I am trying this workaround but in console I see an error: GET http://localhost:8077/Ext/DateExtras.js?_dc=1655973546280 net::ERR_ABORTED 404 (Not Found) I use last unigui Thank you Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now