Hello,
I am getting come over all issues one by one and now it mostly ok. But I have some couple of issue left:
1) I can add a new row grid when I hit addRow button. New row comes with json data perfectly. (CODE-1). This is possible if there is records on the gird on screen. But if grid is empty and screen shows message as (No rows to display.), and I hit addRow button, I get no error message on "Firebug console" and addRow does not work.
Could you please help to solve? Thanks
addRow function
function addRow() {
if (isEditing()) {
return false;
}
var rowData = [];
$.ajax($.extend({}, {
dataType: "json",
type: "POST",
async: false
}, {
url: "Grid.asp?isl=YeniSatir&ID=11906",
success: function (response) {
rowData = response;
}
}));
//var test1=$grid.pqGrid( "option", "dataModel.rPP" );
//$grid.pqGrid( "option", "dataModel.rPP", test1+1 );
//alert(rowData['CEKINO']);
//var rowIndxPage = $grid.pqGrid( "option", "dataModel.rowIndxPage" );
//var recIndx = $grid.pqGrid( "option", "dataModel.recIndx" );
//var numberCell = $grid.pqGrid( "option", "dataModel.numberCell" );
//alert(numberCell+'/'+rowIndxPage+'/'+recIndx);
$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();
}
}
/*
,{ type: 'button', label: 'New Button',style: 'margin:0px 5px;', icon: 'ui-icon-plus', listeners: [{ click: addRow}] }
*/
dataModel
dataModel: {
recIndx: "ID",
location: "remote",
sorting: "remote",
paging: "remote",
dataType: "JSON",
method: "POST",
sortIndx: "ID",
sortDir: "down",
colIndx:"ID",
url: "Grid.asp?isl=Grid",
curPage: 1,
rPP: 10,
rPPOptions: [1, 10, 20, 30, 40, 50, 100, 500, 1000],
getData: function (dataJSON) {
return {curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: dataJSON.data };
}
Empty data return json ("No rows to display." )
{}
Normal data return json
{"totalRecords":"17","curPage":"1","data":[{"ID":"74902","ORDERNO":"13WM411-P01","STYLE":"13WM411"},{"ID":......}]}
(CODE-1) new rowData return json
{
"ORDERNO": "13WM411-P01",
"STYLE": "13WM411",
"SDATE": "29/11/2013",
"SR": "1"
}