ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: stevejacobsen on December 13, 2016, 10:08:58 am
-
I have a button that calls a function to insert a record in my database, get the inserted record id and then insert the record in the grid with that id. But I'm not able to get to the next step of editing the record. The line with "editFirstCellInRow" returns an error:
grid.editFirstCellInRow is not a function
The row is getting created and it is getting past the "addClass" line. Do I need something else?
function service_add(grid)
{
$.ajax({
context: grid,
dataType: 'text',
url: "/utilities/ajax_add_service.php",
success: function (data) {
var id = data;
var rowIndx = 0;
today = today();
$("#services_grid").pqGrid("addRow", {newRow: {id: id, service_date: today}, rowIndx: rowIndx, rowIndxPage: 0});
grid.addClass({rowIndx: rowIndx, cls: 'pq-row-edit'});
grid.editFirstCellInRow({rowIndx: rowIndx});
//show the save button .
var $tr = grid.getRow({rowIndx: rowIndx}),
$btn = $tr.find("#saveservice");
$btn.button("option", {label: "Save", "icons": {primary: "ui-icon-check"}})
.unbind("click")
.click(function (evt) {
return service_save(rowIndx, grid);
})
.show();
}
});
}
-
Please check the value of grid variable. It's supposed to be grid instance, not a jQuery object.
-
Yep, I had some errant code in the calling button. Now I'm just dealing with the next lines. The button is not initialized yet so I can't work with it. I'll play with it and see if I can get past that.
Thanks!
Steve