Dear Sir,
Please find below code for addrow and editrow. Upon clicking the add row button, call is going to editrow as expected, but it is also going to update. This is adding a blank row in my paramgrid before I am able to enter any data. I would appreciate if you could help me in finding the error. This started happening after upgrading to paramquerypro 2.1.0.
function addRow($grid) {
//alert("inadd");
if (isEditing($grid)) {
return false;
}
//append empty row in the first row.
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth() + 1; //January is 0!
var yyyy = today.getFullYear();
if (dd < 10) {
dd = '0' + dd
}
if (mm < 10) {
mm = '0' + mm
}
today = dd + '/' + mm + '/' + yyyy;
var rowData = { scsno: "", ItemCd: "", Descript: "", Qty: 0.0, Note: "", FFRFlg: "", Rowid: "" }; //empty row template
$grid.pqGrid("addRow", { rowIndxPage: 0, rowData: rowData });
var $tr = $grid.pqGrid("getRow", { rowIndxPage: 0 });
if ($tr) {
//simulate click on edit button.
$tr.find("button.edit_btn").click();
}
}
//called by edit button.
function editRow(rowIndx, $grid) {
//alert("in edit");
$grid.pqGrid("addClass", { rowIndx: rowIndx, cls: 'pq-row-edit' });
$grid.pqGrid("editFirstCellInRow", { rowIndx: rowIndx });
//change edit button to update button and delete to cancel.
var $tr = $grid.pqGrid("getRow", { rowIndx: rowIndx }),
$btn = $tr.find("button.edit_btn");
$btn.button("option", { label: "Update", "icons": { primary: "ui-icon-check" } })
.unbind("click")
.click(function (evt) {
evt.preventDefault();
return update(rowIndx, $grid);
});
$btn.next().button("option", { label: "Cancel", "icons": { primary: "ui-icon-cancel" } })
.unbind("click")
.click(function (evt) {
$grid.pqGrid("quitEditMode");
$grid.pqGrid("removeClass", { rowIndx: rowIndx, cls: 'pq-row-edit' });
$grid.pqGrid("refreshRow", { rowIndx: rowIndx });
$grid.pqGrid("rollback");
});
}
Thanks,
SVK