EasyUI Forum
October 10, 2024, 11:34:44 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: closing datetimebox  (Read 8260 times)
korenanzo
Guest
« on: September 25, 2017, 09:11:12 AM »

Hi,

in a datetimebox , when  clicking a calendar date I need the same behaviour of OK button, that is: selecting the new date and time,move it in the textbox and close the calendar: how can I do this?

THanks ,ric
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: September 25, 2017, 05:13:16 PM »

Please try this code:
Code:
var dt = $('#dt');
dt.datetimebox({});
var c = dt.datetimebox('calendar');
var t = dt.datetimebox('spinner');
c.calendar({
onSelect: function(date){
setValue();
}
})
t.timespinner({
onChange: function(value){
setValue();
}
})
function setValue(){
var date = c.calendar('options').current;
date = new Date(date.getFullYear(), date.getMonth(), date.getDate(), t.timespinner('getHours'), t.timespinner('getMinutes'), t.timespinner('getSeconds'));
var val = dt.datetimebox('options').formatter.call(dt[0],date);
dt.datetimebox('setValue', val);
}
Logged
rannacher
Jr. Member
**
Posts: 52


View Profile
« Reply #2 on: January 25, 2019, 05:30:58 PM »

Hello,

I have exactly the same problem, but dont understand where to put this code.

Cannot be onSelect/onChange in datetimebox data-options as there I dont get the time, only date.
And if I just put outside afterwards in normal script tag then it does not work either.

I simply dont get the time when clicking on the datetimebox calendar and it also does not closed as wanted after the click.

Help appreciated very much and thx in advance !!!

BR Michael.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!