I have two jqgrids. On select of any row from 1st grid my 2nd grid is getting loaded. I want to edit the 2nd grid (using inline edit). There is a column "voucherDate" in 2nd grid and "loanReason" in 1st grid. Datepicker is used to edit voucherDate column.
Now what I want is to set minDate property in this datepicker and the minDate should be "loanReason" of 1st grid. I am not able to achieve this. Below is some code snippet.
ColModel of 2nd grid
{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 of 1st Grid
{name : 'loanReason', index : 'tcl.loan_date',width : 130, align: "center",
searchoptions: { dataInit: initDateSearch, sopt: ['cn'] },
editable : true, editoptions : {readonly : 'readonly'}
}
I was trying to do this by using the below code(cboLoanEditList is 1st grid's name) in minDate property of datepicker, but this is not working :
var row = jQuery("#cboLoanEditList").jqGrid('getRowData',editedRow);
var loanDate = row.loanReason;
I got the answer. Find below code :
{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 }
Instead of writing that jquery line directly inside minDate, I wrote it before the datepicker starts and it just worked like a charm.
What Paulo Diogo suggested was correct but that was from a textbox and not from grid which I wanted. Anyway thanks Paulo Diogo for replying. :)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments