allow to disable date widget with set_readonly on run-time

This commit is contained in:
Ralf Becker 2014-12-02 17:19:13 +00:00
parent 1a890a90f3
commit 4d80104403
2 changed files with 15 additions and 1 deletions

View File

@ -106,6 +106,20 @@ var et2_date = et2_inputWidget.extend(
} }
}, },
/**
* Dynamic disable or enable datepicker
*
* @param {boolean} _ro
*/
set_readonly: function(_ro)
{
if (this.input_date && !this.input_date.attr('disabled') != !_ro)
{
this.input_date.attr('disabled', !!_ro)
.datepicker('option', 'disabled', !!_ro);
}
},
/** /**
* Set (full) year of current date * Set (full) year of current date
* *

View File

@ -83,7 +83,7 @@ egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd)
if (!calendar_translated) if (!calendar_translated)
{ {
// Set template's icon for date popup - could probably use jquery-ui icons // Set template's icon for date popup - could probably use jquery-ui icons
_egw.css(".et2_date input.hasDatepicker:hover", "background-image: url(" + egw().image('datepopup') + ")"); _egw.css(".et2_date input.hasDatepicker:enabled:hover", "background-image: url(" + egw().image('datepopup') + ")");
translateCalendar(); translateCalendar();
calendar_translated = true; calendar_translated = true;