我有两个jqgrids。在从第一网格中选择任何行时,我的第二网格将被加载。我想编辑第二个网格(使用内联编辑)。在第二个网格中有一个“ voucherDate”列,在第一个网格中有一个“ loanReason”列。Datepicker用于编辑voucherDate列。
现在,我要在此日期选择器中设置minDate属性,并且minDate应该是第一个网格的“ loanReason”。我无法实现这一目标。下面是一些代码片段。
第二网格的ColModel
{name : 'voucherDate', index : 'voucher_date',width : 150, align: "center", editable : true, editoptions:{size:20,
dataInit:function(el){
$(el).datepicker({
dateFormat:'dd-M-yy',
changeMonth: true,
changeYear: true,
numberOfMonths: 1,
maxDate : '${currentDate}'
});
}},
search : true, searchoptions: { dataInit: repaymentDateSearch, sopt: ['eq','cn'] }, sortable : true }
第一个网格的ColModel
{name : 'loanReason', index : 'tcl.loan_date',width : 130, align: "center",
searchoptions: { dataInit: initDateSearch, sopt: ['cn'] },
editable : true, editoptions : {readonly : 'readonly'}
}
我试图通过在datepicker的minDate属性中使用以下代码(cboLoanEditList是第一个网格的名称)来执行此操作,但这不起作用:
var row = jQuery("#cboLoanEditList").jqGrid('getRowData',editedRow);
var loanDate = row.loanReason;
我得到了答案。查找以下代码:
{name : 'voucherDate', index : 'voucher_date',width : 150, align: "center", editable : true, editoptions:{size:20,
dataInit:function(el){
var row = jQuery("#cboLoanEditList").jqGrid('getRowData',editedRow);
$(el).datepicker({
dateFormat:'dd-M-yy',
changeMonth: true,
changeYear: true,
numberOfMonths: 1,
maxDate : '${currentDate}',
minDate : row.loanDate
});
}},
search : true, searchoptions: { dataInit: repaymentDateSearch, sopt: ['eq','cn'] }, sortable : true }
我没有在minDate中直接编写该jquery行,而是在datepicker启动之前编写了它,它就像一个符咒一样工作。
Paulo Diogo提出的建议是正确的,但这是来自文本框而不是我想要的网格。无论如何,感谢Paulo Diogo的回复。:)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句