jqgrid 内联编辑时 datepicker 中的 minDate
minDate in datepicker while inline editing of jqgrid
我有两个jqgrids。在第一个网格的任何行的 select 上,我的第二个网格正在加载。我想编辑第二个网格(使用内联编辑)。第二个网格中有一个列 "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'}
}
我试图通过在日期选择器的 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 行,而是在日期选择器启动之前写了它,它就像一个魅力。
Paulo Diogo 的建议是正确的,但那是来自文本框而不是我想要的网格。无论如何感谢 Paulo Diogo 的回复。 :)
我有两个jqgrids。在第一个网格的任何行的 select 上,我的第二个网格正在加载。我想编辑第二个网格(使用内联编辑)。第二个网格中有一个列 "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'}
}
我试图通过在日期选择器的 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 行,而是在日期选择器启动之前写了它,它就像一个魅力。
Paulo Diogo 的建议是正确的,但那是来自文本框而不是我想要的网格。无论如何感谢 Paulo Diogo 的回复。 :)