• 【转】Jqgrid学习之ColModel API


    ColModel 是jqGrid里最重要的一个属性,设置表格列的属性。

    属性

    数据类型

    备注

    默认值

    align

    string

    left, center, right.

    left

    classes

    string

    设置列的css。多个class之间用空格分隔,如:'class1 class2' 。表格默认的css属性是ui-ellipsis

    empty string

    datefmt

    string

    ”/”, ”-”, and ”.”都是有效的日期分隔符。y,Y,yyyy 年YY, yy 月m,mm for monthsd,dd 日.

    ISO Date (Y-m-d)

    defval

    string

    查询字段的默认值

    editable

    boolean

    单元格是否可编辑

    false

    editoptions

    array

    编辑的一系列选项。{name:’__department_id’,index:’__department_id’,200,editable:true,edittype:’select’,editoptions: {dataUrl:”${ctx}/admin/deplistforstu.action”}},这个是演示动态从服务器端获取数据。

    empty

    editrules

    array

    编辑的规则{name:’age’,index:’age’, 90,editable:true,editrules: {edithidden:true,required:true,number:true,minValue:10,maxValue:100}},设定 年龄的最大值为100,最小值为10,而且为数字类型,并且为必输字段。

    empty

    edittype

    string

    可以编辑的类型。可选值:text, textarea, select, checkbox, password, button, image and file.

    text

    fixed

    boolean

    列宽度是否要固定不可变

    false

    formoptions

    array

    对于form进行编辑时的属性设置

    empty

    formatoptions

    array

    对某些列进行格式化的设置

    none

    formatter

    mixed

    对列进行格式化时设置的函数名或者类型

    {name:’sex’,index:’sex’, align:’center’,60,editable:true,edittype:’select’,editoptions: {value:’0:待定;1:男;2:女’},formatter:function(cellvalue, options, rowObject){
    var temp = “<img src=’${ctx}/jquery-ui-1.7.2.custom/css/img/”
    if(cellvalue==1){
    temp = temp +”user-white.png”;
    } else if(cellvalue==2){
    temp = temp +”user-white-female.png”;
    } else {
    temp = temp + “user-silhouette.png”;
    }
    temp = temp + “‘ border=’0′ />”
    return temp;
    }},//返回性别的图标。

    none

    hidedlg

    boolean

    是否显示或者隐藏此列

    false

    hidden

    boolean

    在初始化表格时是否要隐藏此列

    false

    index

    string

    索引。其和后台交互的参数为sidx

    empty

    jsonmap

    string

    定义了返回的json数据映射

    none

    key

    boolean

    当从服务器端返回的数据中没有id时,将此作为唯一rowid使用只有一个列可以做这项设置。如果设置多于一个,那么只选取第一个,其他被忽略

    false

    label

    string

    如果colNames为空则用此值来作为列的显示名称,如果都没有设置则使用name 值

    none

    name

    string

    表格列的名称,所有关键字,保留字都不能作为名称使用包括subgrid, cb and rn.

    Required

    resizable

    boolean

    是否可以被resizable

    true

    search

    boolean

    在搜索模式下,定义此列是否可以作为搜索列

    true

    searchoptions

    array

    设置搜索参数

    empty

    sortable

    boolean

    是否可排序

    true

    sorttype

    string

    用在当datatype为local时,定义搜索列的类型,可选值:int/integer - 对integer排序float/number/currency - 排序数字date - 排序日期text - 排序文本

    text

    stype

    string

    定义搜索元素的类型

    text

    surl

    string

    搜索数据时的url

    empty

    width

    number

    默认列的宽度,只能是象素值,不能是百分比

    150

    xmlmap

    string

    定义当前列跟返回的xml数据之间的映射关系

    none

    unformat

    function

    ‘unformat’单元格值

    null

  • 相关阅读:
    使用vue vantUi框架 根字体是37.5 和默认根字体75不一致,导致页面组件样式变小
    html2canvas ---- canvas里的width和style里面的width区别
    禁止浏览器记住密码操作
    微信小程序的学习和应用
    关于swiper的使用 安卓没有反应
    iconfont阿里云的使用
    Node.js与MongoDB的合作
    Hacker2
    SR选取公式
    树莓派设置静态ip2
  • 原文地址:https://www.cnblogs.com/kofxxf/p/3987810.html
Copyright © 2020-2023  润新知