jquery向jqgrid插入一行

var ids = jQuery("#gridcontent").jqGrid("getDataIDs");//得到jqgrid当前行数        
var rowid1 = Math.max.apply(Math,ids);//获得当前最大行号
var netporfit = rowid+1;//
var dataRow = {
        STORENAME : "净利润",
        SEPPERFORMANCE : sepprofit,
        LASTYEARSEPPERFORMANCE : lastyearsepprofit,
        LASTYEAROCTPERFORMANCE : lastyearoctprofit,
        YEARPERFORMANCESUM : yearprofit,
        LASTYEARPERFORMANCESUM : lastyearprofit
        };

//将新添加的行插入到最后列
$("#gridcontent").jqGrid("addRowData", netporfit, dataRow,"last");
//设置grid单元格不可编辑
$("#gridcontent").setGridParam({
    cellEdit : false
});

你可能感兴趣的:(jquery向jqgrid插入一行)