How to remove datepicker slider

955 views
Skip to first unread message

Amine Hamdi

unread,
Aug 12, 2015, 2:42:34 PM8/12/15
to Easy!Appointments - Support Group
Hello there,

I need to remove the hour slider in the backend and replace it by another better way (more practical with a dropdown list for example or whatever).

Thank you very much in advance for any idea or useful option.

Alex Tselegidis

unread,
Aug 12, 2015, 5:39:23 PM8/12/15
to Easy!Appointments - Support Group
E!A uses the following add-on for the time picker:

http://trentrichardson.com/examples/timepicker

On the options tab there are plenty of stuff to change.

You should also check the official jquery ui datepicker API page:

http://api.jqueryui.com/datepicker

The modifications must be done on the widget instantiation on the JS files of the app located in the assets directory.

Amine Hamdi

unread,
Aug 13, 2015, 8:39:29 PM8/13/15
to Easy!Appointments - Support Group
I replaced the controlType parameter to 'select' in the /web/assets/js/libs/jquery/jquery-ui-timepicker-addon.js file like this:

Before: controlType: 'slider',

After: controlType: 'select',

then adjust the css and it worked fine for me.

Thank you very much.

Craig Tucker

unread,
Aug 14, 2015, 11:17:58 AM8/14/15
to Easy!Appointments - Support Group
I really like this modification. Thanks for putting it out there.

Andreas Pawlowski

unread,
Feb 21, 2016, 10:47:43 AM2/21/16
to Easy!Appointments - Support Group
Which css-file did you adjusted?
Please let me know the settings use used.
Thanks a lot.

Amine Hamdi

unread,
Feb 24, 2016, 3:50:03 PM2/24/16
to Easy!Appointments - Support Group
Hi Andreas,

I'am using this library: http://trentrichardson.com/examples/timepicker/ , you should have a look at the examples.


I did not adjust any CSS file.

Solution 1 - You need only this part of code in your JavaScript file (If you are using a separated JS file for your application):
$('#slider_example_4').datetimepicker({
	controlType: 'select',
	timeFormat: 'hh:mm tt'
});

When you add those lines and as you can see, the controlType should be 'select' instead of slider.

Solution 2 - You can also setup this setting by default by changing the original js file (jquery-ui-timepicker-addon.js) like this :


this._defaults = { // Global defaults for all the datetime picker instances
			showButtonPanel: true,
			timeOnly: false,
			....
			...
			controlType: 'slider', <=== change this to ==> controlType: 'select',
			...
			parse: 'strict',
			afterInject: null
		};
		$.extend(this._defaults, this.regional['']);
                ...
                            
With this change, all your timepickers will display by default the select form instead of the slider.

Personally, I am using the second solution because I need to use select form in all my timepicker's addon.

Hope it helps. If you still have questions, just ask.

Peace.
Reply all
Reply to author
Forward
0 new messages