Adding a button to a row in jqgrid

前端 未结 5 1129
日久生厌
日久生厌 2021-02-04 04:59

I want to add a button to each row in my grid that will bring up a new window. Do not see this feature in this very rich control. Must be missing something

5条回答
  •  执笔经年
    2021-02-04 05:30

    Here's one example, from the jqGrid demos page:

    jQuery("#rowed2").jqGrid({ 
        url:'server.php?q=3', 
        datatype: "json", 
        colNames:['Actions','Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], 
        colModel:[ 
            {name:'act', index:'act', width:75,sortable:false}, 
            {name:'id',index:'id', width:55}, 
            {name:'invdate',index:'invdate', width:90, editable:true}, 
            {name:'name',index:'name', width:100,editable:true}, 
            {name:'amount',index:'amount', width:80, align:"right",editable:true}, 
            {name:'tax',index:'tax', width:80, align:"right",editable:true}, 
            {name:'total',index:'total', width:80,align:"right",editable:true}, 
            {name:'note',index:'note', width:150, sortable:false,editable:true} 
        ], 
        rowNum:10, 
        rowList:[10,20,30], 
        imgpath: gridimgpath, 
        pager: jQuery('#prowed2'), 
        sortname: 'id', 
        viewrecords: true, 
        sortorder: "desc", 
        gridComplete: function(){ 
            var ids = jQuery("#rowed2").getDataIDs(); 
            for(var i=0;i"; 
                se = ""; 
                ce = ""; 
                jQuery("#rowed2").setRowData(ids[i],{act:be+se+ce}) 
            } 
        }, 
        editurl: "server.php", 
        caption:"Custom edit " }
    ).navGrid("#prowed2",{edit:false,add:false,del:false}); 
    

    You can also do it with a custom formatter.

提交回复
热议问题