web/data/cubicweb.widgets.js
changeset 11048 96d57cb8b644
parent 10465 5b18e2e4dd71
equal deleted inserted replaced
11042:079b32f4cd0d 11048:96d57cb8b644
    21     var wdgclass = Widgets[wdgnode.getAttribute('cubicweb:wdgtype')];
    21     var wdgclass = Widgets[wdgnode.getAttribute('cubicweb:wdgtype')];
    22     if (wdgclass) {
    22     if (wdgclass) {
    23         return new wdgclass(wdgnode);
    23         return new wdgclass(wdgnode);
    24     }
    24     }
    25     return null;
    25     return null;
       
    26 }
       
    27 
       
    28 function renderJQueryDatePicker(subject, button_image, date_format, min_date, max_date){
       
    29     $widget = cw.jqNode(subject);
       
    30     $widget.datepicker({buttonImage: button_image, dateFormat: date_format,
       
    31                         firstDay: 1, showOn: "button", buttonImageOnly: true,
       
    32                         minDate: min_date, maxDate: max_date});
       
    33     $widget.change(function(ev) {
       
    34         maxOfId = $(this).data('max-of');
       
    35         if (maxOfId) {
       
    36             cw.jqNode(maxOfId).datepicker("option", "maxDate", this.value);
       
    37         }
       
    38         minOfId = $(this).data('min-of');
       
    39         if (minOfId) {
       
    40             cw.jqNode(minOfId).datepicker("option", "minDate", this.value);
       
    41         }
       
    42     });
    26 }
    43 }
    27 
    44 
    28 /**
    45 /**
    29  * .. function:: buildWidgets(root)
    46  * .. function:: buildWidgets(root)
    30  *
    47  *