We all know that ExtJS has a date component Datefield, but until the ExtJS 5.0 version of the date component can only select the date, can not select the time (specific to time, minutes, seconds), and the actual work will often have the need for date and time to select the demand, we can only expand their own, There are some extensions of ready-made components on the Web, either early versions, ExtJs5.0 versions, or inadequate testing, and no code to use. So I can only do it by myself. First look at the finished:
Let's talk about the idea first:
We need a component like this, first we have to have a can set the time, minutes, seconds of the component, we named Timepickerfield, and then instantiate this Timepickerfield to DatePicker, Of course we can not directly in the DatePicker source to change, so we need to inherit the datepicker extension of another component, named DateTimePicker , and the final Datetimefield to be implemented is to use this datetimepicker, and Datetimefield need to inherit Ext.form.field.Date to do the expansion.
From the above ideas we can know that to complete such an extension component, at least three files are required:
1, Timepickerfield.js
2, Datetimepicker.js
3, Datetimefield.js
The above is the general expansion of ideas and extension components of the inheritance relationship, need to obtain the full source, please click here .
ExtJS 5 Selectable Date + Time components Datetimefield