据我所知,jqgrid每列的宽度是使用colModel参数定义的.假设我想在单击按钮后调整列的大小,我该如何执行此操作?
我的Jqgrid.All列中有很多列,显示两侧的额外空间.我希望该列没有额外的间距.列宽应根据其内容具有宽度.我尝试过autowidth但它不起作用.
实际行为如下所示:
-----------------------------------------------
|     Name     |     Mobile     |    Email    |
----------------------------------------------- 
Run Code Online (Sandbox Code Playgroud)
而我需要的是:
----------------------
|Name|Mobile No|Email|
----------------------
Run Code Online (Sandbox Code Playgroud)
这是我的代码
 $("#list").jqGrid({
     datatype: "local",
     data: mydata,
     colNames: ["Name", "Mobile", "Email", "Amount", "Tax", "Total", "Closed", "Shipped via", "Notes"],
     colModel: [
                { name: "id", width: 65, align: "center", sorttype: "int", hidden: true },
                { name: "invdate", width: 80, align: "center", sorttype: "date",
                    formatter: "date", formatoptions: { newformat: "d-M-Y" }, datefmt: "d-M-Y"
                },
                { name: "name", width: 70 },
                { name: "amount", width: 75, formatter: …Run Code Online (Sandbox Code Playgroud) 我使用下面的示例代码来创建带有subGrids的jqGrid.
就我而言,我删除了subGrids的标题.所以,它看起来像一个分组.
在这里,每当我调整主网格列的大小.我检查了jqGrid文档并找到了" resizeStop ",它返回了列id和新的宽度.
但是,没有找到类似setSize的列.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>SubGrid Editable</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/redmond/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.3.2/css/ui.jqgrid.css" />
<style>
    .groupColumn {
            background-color: #E3E3D7 !important;
            border: 1px solid #F4F4e5;
            font-weight: bold; !important;
    }
    .lockedColumn {
            background-color: #E3E3D7 !important;
            border: 1px solid #F4F4e5;
    }
    .ui-jqgrid .ui-subgrid td.subgrid-data {
        border-top: 0 none !important;
        border-right: 0 none !important;
        border-bottom: 0 none !important;
    }
</style> …Run Code Online (Sandbox Code Playgroud)