jqgrid总结

1.添加按钮

$("#jqgridtable").jqGrid('editGridRow','new',{height:280,reloadAfterSubmit:true,recreateForm:true});

2.编辑数据

var selRowId = $('#jqgridtable').jqGrid('getGridParam','selrow');
$("#jqgridtable").jqGrid('editGridRow',selRowId,{height:280,reloadAfterSubmit:false,closeAfterEdit:true});


3.搜索按钮

$("#jqgridtable").jqGrid('searchGrid', {sopt : [ 'cn' ]});


4.设置多选

multiselect : true,//是否多选
multiselectWidth:30,//多像列宽

5.添加数据

var mydata = [
    {id:"1",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},
    {id:"2",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}];

for(var i=0; i <= mydata.length; i++){
    jQuery("#list4").jqGrid('addRowData',i+1,mydata[i]);
}


6.设置表格固定宽度,不变形(调整列宽度不会改变表格的宽度)

shrinkToFit:true,
forceFit:true,
$detailgrid.setGridWidth($(".mainGridContent").width());//设置表格宽度

7.jqgrid取消提示框

    colModel:[
	        {name:'hid',index:'hid',align:'center',hidden:true},
	        {name:'code',index:'code',align:'center',title:false},
	        {name:'name',index:'name',title:false},
	        {name:'type',index:'type',title:false},
	        {name:'note',index:'note', align:'center',title:false}
	    ],



你可能感兴趣的:(jqGrid)