jqGrid水平滚动条 [英] jqGrid horizontal scrollbar

查看:463
本文介绍了jqGrid水平滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用jQuery和jqGrid开发了AJAX接口.

I developed AJAX interface with jQuery and jqGrid.

如何从jqGrid表中删除水平滚动条?

How I can remove horizontal scrollbar from my jqGrid table?

http://dskarataev.ru/jqgrid.png

如果设置autowidth: true,则得到表的宽度=列的总宽度,但是我需要表的宽度=函数getSelectedTabHref()返回的id的父元素的宽度.

If I set autowidth: true, then I get width of table = sum width of columns, but I need width of table = width of parent element with id returned by function getSelectedTabHref()

所以我做函数:

$(window).bind('resize', function() {
  $('#tasks').setGridWidth($(getSelectedTabHref()).width());
  $('#tasks').setGridHeight($(window).height()-190);
}).trigger('resize');

这是我创建jqGrid表的方法:

and here is how I create jqGrid table:

$('#tasks').jqGrid({
  datatype: 'local',
  colNames:[labels['tasksNum'],labels['tasksAdded']+"/"+labels['tasksAccepted'],labels['tasksOperator'],labels['tasksClient'],labels['tasksManager'],labels['tasksDesc']],
  colModel :[
    {name:'taskId', index:'taskId', width:1, align:'right'},
    {name:'taskAdded', index:'taskAdded', width:3},
    {name:'taskOperator', index:'taskOperator', width:4},
    {name:'taskClient', index:'taskClient', width:7},
    {name:'taskManager', index:'taskManager', width:4},
    {name:'taskDesc', index:'taskDesc', width:8}]
});

推荐答案

我调整了ui.grid.css,因为我根本不需要水平滚动条.我是这样做的:

i adjusted ui.grid.css because i did not need a horizontal scrollbar at all. i did this:

.ui-jqgrid .ui-jqgrid-bdiv {
  position: relative; 
  margin: 0em; 
  padding:0; 
  /*overflow: auto;*/ 
  overflow-x:hidden; 
  overflow-y:auto; 
  text-align:left;
}

评论是这样的,我只是用overflow-x隐藏了水平滚动条,现在一切都很好.

the commented was how it was, i just used overflow-x to hide the horizontal scrollbar and now all is fine with me.

这篇关于jqGrid水平滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆