ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: Soumya on February 11, 2015, 02:21:59 am
-
Hi,
I am following the pro demo for in line editing.
i have the below code for editrow
function editRow(rowIndx, $gridMain)
{
//debugger;
$gridMain.pqGrid("addClass", { rowIndx: rowIndx, cls: 'pq-row-edit' });
$gridMain.pqGrid("editFirstCellInRow", { rowIndx: rowIndx });
//change edit button to update button and delete to cancel.
var $tr = $gridMain.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, $gridMain);
});
$btn.next().button("option", { label: "Cancel", "icons": { primary: "ui-icon-cancel" } })
.unbind("click")
.click(function (evt)
{
$gridMain.pqGrid("quitEditMode")
.pqGrid("removeClass", { rowIndx: rowIndx, cls: 'pq-row-edit' })
.pqGrid("rollback");
});
}
for some reason I can only Update button and not the cancel button in the row.
can you guide if i am missing something here.
-
Have you made any other changes in the source code.
Just find out what $btn.next() is pointing to by console.log?
var $next = $btn.next();
console.log( $next.length );
console.log( $next[0] );
$btn.next().button("option", { label: "Cancel", "icons": { primary: "ui-icon-cancel" } })
.unbind("click")
.click(function (evt)
{
$gridMain.pqGrid("quitEditMode")
.pqGrid("removeClass", { rowIndx: rowIndx, cls: 'pq-row-edit' })
.pqGrid("rollback");
});
-
length is 0 and it says undefined
-
Have you added the markup for the buttons in render callback of buttons column.
render: function (ui) {
return "<button type='button' class='edit_btn'>Edit</button>\
<button type='button' class='delete_btn'>Delete</button>";
}
-
Yes i did . And so the update button shows up atleast once i click the Edit
render: function (ui)
{
return "<button type='button' class='edit_btn'>Edit</button>";
}
Attached the picture.
-
I don't see delete button in your render callback.
-
I don't need the delete button as we are not doing any deletions on the records. The user can only for do update on the record.
-
so you can hide it in render with inline style= display: none;
and show it in editRow() function
$btn.next().show()
-
That worked. The button has to be initialized as well in the grid pqgridrefresh event.
Thanks for the help