EasyUI Forum
March 28, 2024, 10:32:04 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: DateBox Today button and the validator  (Read 4649 times)
chrwei
Full Member
***
Posts: 219


View Profile Email
« on: August 10, 2020, 07:19:13 AM »

When using the calendarOptions validator, if today's date isn't valid, the Today button still lets you select today. 

in date components in other UI tookits, the today button only takes you to today in the calendar component, it does not select the date and populate the field.  this change would also fix this issue.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #1 on: August 13, 2020, 02:53:39 AM »

This issue has been solved. You can also set the 'buttons' to custom the button bar. Make sure to update to the newest version.
Code:
<DateBox
    ref={el => this.datebox = el}
    panelStyle={{ width: 250, height: 300 }}
    buttons={(value) => {
        return (
            <div className="datebox-button f-row" style={{ justifyContent: 'space-between', padding: '5 10px' }}>
                <LinkButton plain onClick={() => this.datebox.calendar.moveTo(new Date())}>Today</LinkButton>
                <LinkButton plain onClick={() => this.datebox.calendar.selectDate(new Date())}>Ok</LinkButton>
                <LinkButton plain onClick={() => this.datebox.closePanel()}>Close</LinkButton>
            </div>
        )
    }}
/>
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!