General Category > Help for ParamQuery Pro

Empty grid, addRow function

(1/1)

omerix:
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

--- Code: ---    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}] }
*/

--- End code ---


dataModel

--- Code: ---    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 };
        }

--- End code ---

Empty data return json ("No rows to display."  )

--- Code: ---{}

--- End code ---

Normal data return json

--- Code: ---{"totalRecords":"17","curPage":"1","data":[{"ID":"74902","ORDERNO":"13WM411-P01","STYLE":"13WM411"},{"ID":......}]}

--- End code ---

(CODE-1) new rowData return json

--- Code: ---{
    "ORDERNO": "13WM411-P01",
    "STYLE": "13WM411",
    "SDATE": "29/11/2013",
    "SR": "1"
}

--- End code ---

paramvir:
[ Only Pro members may read this post. ]

omerix:
Hello ,

I want to ad done more thing to my earlier request. If grid is empty, it is also ok to get one new entery row. Is this possible?

paramvir:
[ Only Pro members may read this post. ]

omerix:
Thanks param,

Code changed. Worked

--- Code: ---var rowData = [];
--- End code ---


--- Code: ---var rowData;
--- End code ---

Navigation

[0] Message Index

Go to full version