2013-05-21 42 views
2

我有如下因素的日期选择器禁用SJ:日期选择在Struts 2

<sj:datepicker 
    id="dateTo_id%{index}" 
    name="billingItems[%{index}].dateTo" 
    value="%{billingItems[#index].dateTo}" 
    displayFormat="dd.mm.yy" 
    cssClass="customDatePicker" 
    buttonImage="/images/icons/calendar-blue.png" 
    parentTheme="css_custom" 
    disabled="true" 
/> 

但我的问题是:我仍然可以在图像上单击。并打开日期选择器。

opening datepicker

什么是这个问题的解决方案?

编辑:

某些字段需要留编辑。 enter image description here

回答

1

尝试使用此

$("button.ui-datepicker-trigger").attr("disabled", "disabled"); 

或者你可以用这个

$('#your_datepicker_id').datepicker('disable'); 
+0

这是工作,但现在我有问题,这个调用禁用所有datepickers。在页面上有一些禁用,一些启用。 – kozla13

+0

您可以为每个datepicker使用不同的'id'属性,并使用'$(“#id-of-datepicker”)。attr(“disabled”,“disabled”);'而不是。 – Armaggedon

+0

@ kozla13尝试使用'$('#your_datepicker_id')。datepicker('disable');' –

相关问题