请问jqGrid怎么动态的改变里边的列

http://zhidao.baidu.com/question/421647527.html?quesup2&oldq=1悬赏分在下边的那个地址里,好心人帮帮忙,急用... http://zhidao.baidu.com/question/421647527.html?quesup2&oldq=1
悬赏分在下边的那个地址里,好心人帮帮忙,急用
展开
 我来答
shenchaoliang
2012-05-11 · TA获得超过1163个赞
知道大有可为答主
回答量:810
采纳率:0%
帮助的人:1519万
展开全部
恩,我的回答这么不显示了,如下

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>jqgridtest</title>
<link rel="stylesheet" type="text/css" media="screen" href="/js/jqgrid/themes/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/js/jqgrid/themes/redmond/jquery-ui-1.7.1.custom.css" />
<script src="/js/jqgrid/js/jquery.js" type="text/javascript"></script>
<script src="/js/jqgrid/js/jquery-ui-1.7.1.custom.min.js" type="text/javascript"></script>
<script src="/js/jqgrid/js/i18n/grid.locale-cn.js" type="text/javascript"></script>
<script src="/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){

var initdata = [
{no:"1",n:"aaa",s:"1",a:"20",addr:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAA",email:"1111.222@aaa.com"},
{no:"2",n:"bbb",s:"2",a:"21",addr:"11111111111111111111111111111",email:"2222.222@aaa.com"},
{no:"3",n:"ccc",s:"1",a:"22",addr:"22222222222222222222222222222",email:"33333.222@aaa.com"},
{no:"4",n:"ddd",s:"2",a:"23",addr:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaa",email:"44444.222@aaa.com"},
{no:"5",n:"eee",s:"2",a:"24",addr:"ccccccccccccccccccccccccccccc",email:"55555.222@aaa.com"}
];

$("#list19").jqGrid({
data:initdata,
datatype: "local",
colNames:['No','Name',"sex","age","addr","email"],
colModel:[
{name:'no',index:'no', width:50,sortable:false},
{name:'n',index:'n', width:80,sortable:false},
{name:'s',index:'s', width:50,sortable:false,hidden:true},
{name:'a',index:'a', width:30,sortable:false,hidden:true},
{name:'addr',index:'addr', width:300,sortable:false,hidden:true},
{name:'email',index:'email', width:100,sortable:false,hidden:true}
],
rowNum:30,
rowList:[10,20,30],
gridview:true,
autowidth:true,
pager: $('#pager19'),
sortname: 'No',
sortorder: "desc",
caption: "demo"
});

$(window).resize(function(){
jqgridresize();
});
});

var jqgridresize = function(){
var bodyw = $(document.body).width();

if(bodyw>600){
$("#list19").jqGrid('showCol',["s","a","addr","email"]);
}
else{
$("#list19").jqGrid('hideCol',["s","a","addr","email"]);
}
}
</script>
</head>

<body>
<table id="list19" class="scroll" cellpadding="0" cellspacing="0"></table>
<div id="pager19" class="scroll" style="text-align:center;"></div>
</body>
</html>
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式