EasyUI 1.3.6 DateBox add Clear button, easyuidatebox
EasyUI 1.3.6 DateBox add Clear button
Effect
EasyUI datebox does not have a clear button. You can add it as follows:
Open jquery. easyui. min. js to see such a mess of code, we can only use the Ctrl + F search function
SearchCurrentText, There is a buttons array at the position found for the first time, and it is added to the center of Today ("Today") and Close ("Close.
{Text: function (_ 947) {return $ (_ 947 ). datebox ("options "). cleanText;}, handler: function (_ 948) {$ (_ 948 ). combo ("setValue ",""). combo ("setText", ""); // sets the null value $ (_ 948 ). combo ("hidePanel"); // click the Clear button to close the date Selection Panel }},
Before adding the code, you can press Ctrl + Shift + F to format it. Otherwise, it is difficult to locate the location to be inserted. After the code is inserted, the context should be as follows:
CurrentText: "Today", closeText: "Close", okText: "OK", buttons: [{text: function (_ 945) {return $ (_ 945 ). datebox ("options "). currentText;}, handler: function (_ 946) {$ (_ 946 ). datebox ("calendar "). calendar ({year: new Date (). getFullYear (), month: new Date (). getMonth () + 1, current: new Date ()}); _ 935 (_ 946) ;},{ text: function (_ 947) {return $ (_ 947 ). datebox ("options "). cleanText;}, handler: function (_ 948) {$ (_ 948 ). combo ("setValue ",""). combo ("setText", ""); // sets the null value $ (_ 948 ). combo ("hidePanel"); // click the Clear button to close the date Selection Panel }}, {text: function (_ 947) {return $ (_ 947 ). datebox ("options "). closeText;}, handler: function (_ 948) {$ (this ). closest ("div. combo-panel "). panel ("close") ;}}],
Finally modify the easyui-lang-zh_CN.js file to add the following statement
$. Fn. datebox. defaults. cleanText = 'clear ';
Because it is clear to open this file, you should know where to add it.
PS: This method is available in
EasyUI 1.3.6The version is passed. Other versions may be slightly different for your reference.
In easyui datebox, how does one initialize a value for the date plug-in?
$ ('# Id'). datebox ('setvalue', dateTime) value assignment
$ ('# Id'). datebox ('getvalue') Value
In easyui, how does datebox obtain the difference between two dates?
Solved!