ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: lgauton on March 05, 2015, 06:44:44 pm
-
Hi I have a grid with inline editing and noticed that what was working correctly under 2.0.4 now doesn't under 2.3.0. - my update function is
function update(rowIndx, $grid) {
if (!$grid.pqGrid("saveEditCell")) {
return false;
}
var rowData = $grid.pqGrid("getRowData", { rowIndx: rowIndx }),
recIndx = $grid.pqGrid("option", "dataModel.recIndx"),
type;
var isValid = $grid.pqGrid("isValid", { rowData: rowData }).valid;
if (!isValid) {
return false;
}
var isDirty = $grid.pqGrid("isDirty");
if (isDirty) {
if (rowData[recIndx] == null) {
//add record.
type = 'add';
}
else {
//update record.
type = 'update';
}
$grid.removeClass({ rowIndx: rowIndx, cls: 'pq-row-edit' });
$grid.commit({ type: type, rows: [rowData] });
$grid.refreshRow({ rowIndx: rowIndx });
}
else {
$grid.quitEditMode();
$grid.removeClass({ rowIndx: rowIndx, cls: 'pq-row-edit' });
$grid.refreshRow({ rowIndx: rowIndx });
}
}
This statement always fails
if (!$grid.pqGrid("saveEditCell")) {
return false;
}
and if I bypass all appears to work but get left with display of Update, Cancel buttons rather than Edit, Delete
Any ideas?
-
In above I mean't to say is 'This statement always returns 'false'
-
Please use below to exclude null, == would also work.
if ($grid.pqGrid("saveEditCell") === false ) {
return false;
}
-
Hi Thanks that fixed the validation issue, but I still have a problem with the Edit, Delete -> Update, Cancel buttons
going to edit mode is Ok, but clicking on Update button does not fully complete and re-display the Edit, Delete buttons - I'm left with Update, Cancel
Any ideas on that
-
That require you to listen to both refresh and refreshRow events.
//use refresh & refreshRow events to display jQueryUI buttons and bind events.
$grid.on('pqgridrefresh pqgridrefreshrow', function () {
http://paramquery.com/pro/demos/editing line 260
-
Hi I have set $grid.on('pqgridrefresh pqgridrefreshrow', function () {
But still get same problem
-
methods invocation syntax is incorrect in your update function.
$grid.quitEditMode(); //incorrect, same for removeClass, commit, refreshRow, etc
$grid.pqGrid('quitEditMode'); //correct
or
var grid = $grid.pqGrid('getInstance').grid;
grid.pqGrid('quitEditMode'); //correct
-
Hi Thanks - I did notice that which helped - but finally resolved by adding this statement after commit, in update function
$grid.pqGrid("quitEditMode")
.pqGrid("removeClass", { rowIndx: rowIndx, cls: 'pq-row-edit' })
.pqGrid("rollback");
now works as previously under 2.0.4