Hi, i test the fiddle, and now i see the buttons ADD/EDIT/DELETE
but when i click on ADD button not show me the dialog box for ADD a new record.
same if prees DELETE button not delete any record.
i added:
function addRow() {
//debugger;
var DM = $grid.pqGrid("option", "dataModel");
var data = DM.data;
var $frm = $("form#crud-form");
$frm.find("input").val("");
$("#popup-dialog-crud").dialog({ title: "Add Record", buttons: {
Add: function () {
var row = [];
//save the record in DM.data.
row[0] = $frm.find("input[name='company']").val();
row[1] = $frm.find("input[name='symbol']").val();
row[3] = $frm.find("input[name='price']").val();
row[4] = $frm.find("input[name='change']").val();
row[5] = $frm.find("input[name='pchange']").val();
row[6] = $frm.find("input[name='volume']").val();
data.push(row);
$grid.pqGrid("refreshDataAndView");
$(this).dialog("close");
},
Cancel: function () {
$(this).dialog("close");
}
}
});
$("#popup-dialog-crud").dialog("open");
}
//delete Row.
function deleteRow() {
var rowIndx = getRowIndx();
if (rowIndx != null) {
var DM = $grid.pqGrid("option", "dataModel");
DM.data.splice(rowIndx, 1);
$grid.pqGrid("refreshDataAndView");
$grid.pqGrid("setSelection", { rowIndx: rowIndx });
}
}
function getRowIndx() {
//var $grid = $("#grid_render_cells");
//var obj = $grid.pqGrid("getSelection");
//debugger;
var arr = $grid.pqGrid("selection", { type: 'row', method: 'getSelection' });
if (arr && arr.length > 0) {
var rowIndx = arr[0].rowIndx;
//if (rowIndx != null && colIndx == null) {
return rowIndx;
}
else {
alert("Select a row.");
return null;
}
}
but not work.
other thing that i see:
when i click on any cell (this edit INLINE) but not change the value...
a dude: what is the name/id of each cell?
any advice? thanks.