2 litostes litostes 于 2013.08.28 10:35 提问

Jquery表单里colModel怎么显示男女

{name:'sex', index:'sex', width:'70', align:'center',editoptions:{value:’1:男;2:女’}},
这样不能显示

1个回答

xy1224657942
xy1224657942   2013.11.27 15:38
已采纳


注意jqGrid放grid.locale-cn.js的后面。否则会报错。

jQuery("#editgrid").jqGrid({
datatype: "local",
height: 450,
colNames:['编号','用户名', '性别', '邮箱', 'QQ','手机号','出生日期'],
colModel:[
{name:'id',index:'id', width:200, sorttype:"int"},
{name:'userName',index:'userName', width:200},
{name:'gender',index:'gender', width:90},
{name:'email',index:'email', width:125,sorttype:"string"},
{name:'QQ',index:'QQ', width:100},

{name:'mobilePhone',index:'mobilePhone', width:120},

{name:'birthday',index:'birthday', width:100, sorttype:"date"}

],
sortname:'id',
sortorder:'asc',
viewrecords:true,
rowNum:10,
rowList:[10,20,30],
pager:"#gridPager",
caption: ""
}).navGrid('#gridPager',{edit:true,add:true,del:true});

    var mydata = [
            {id:"1",userName:"polaris",gender:"男",email:"fef@163.com",QQ:"33334444",mobilePhone:"13223423424",birthday:"1985-10-01"},
            {id:"2",userName:"李四",gender:"女",email:"faf@gmail.com",QQ:"222222222",mobilePhone:"13223423",birthday:"1986-07-01"},
            {id:"3",userName:"王五",gender:"男",email:"fae@163.com",QQ:"99999999",mobilePhone:"1322342342",birthday:"1985-10-01"},
            {id:"4",userName:"马六",gender:"女",email:"aaaa@gmail.com",QQ:"23333333",mobilePhone:"132234662",birthday:"1987-05-01"}
            ];
    for(var i=0;i<=mydata.length;i++)
            jQuery("#editgrid").jqGrid('addRowData',i+1,mydata[i]);
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!