jqgrid可滚动对话框 [英] jqgrid scrollable dialog

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

问题描述

我有一个jqGrid,它具有添加/编辑对话框,该对话框的格式比对话框的高度长,但是对话框不会滚动.我试图在对话框中添加overflow: auto样式,但没有效果:

I have a jqGrid that has add/edit dialogs with a form that's longer than the dialog height but the dialog won't scroll. I've tried to add an overflow: auto style to the dialog but no effect:

$("div.ui-jqdialog-content").css("overflow", "auto");

尽管,如果将auto更改为scroll,我至少会看到一个滚动条,但仍然没有滚动:

Although, if I change auto to scroll, I at least see a scrollbar but still no scrolling:

$("div.ui-jqdialog-content").css("overflow", "scroll");

这至少给了我一点希望,使我走上正确的轨道.

This at least gives me a small glimmer of hope that I'm on the right track.

API文档似乎没有任何支持滚动的方向:

There doesn't seem to be any direction from the API documentation to support scrolling:

http://www.trirand.com/jqgridwiki/doku .php?id = wiki:form_editing

有人知道如何向jqGrid使用的jqModal对话框窗口添加工作滚动条吗?

Does anyone know how to add a working scrollbar to the jqModal dialog window used by jqGrid?

更新

这是一项完全的黑客工作,但我出现了一个滚动条,并且可以执行以下操作:

This is a total hack job but I got a scrollbar to appear and function doing the following:

setTimeout(function() {$("#FrmGrid_list").html('<div style="height: 300px; overflow: auto;">' + $("#FrmGrid_list").html() + '</div>');}, 1000);

我将此附加到afterShowForm事件.但是,这确实不能解决问题,因为它会导致其他字段出现其他问题.

I attached this to the afterShowForm event. However, this really doesn't solve the problem because it causes other issues with other fields.

推荐答案

我想分享自己的解决方案,以供其他人参考.

I thought I'd share my solution for others to reference.

form元素具有默认的height: auto;样式属性,该属性会导致overflow: auto;无法正常工作.为了使溢出滚动,需要将高度设置为固定数字以约束form容器,因此必须使overflow成为必需.

The form element has a default height: auto; style property which causes the overflow: auto; not to function as desired. To make the overflow scroll, the height needs to be set to a fixed number to constrain the form container and therefore make the overflow necessary.

我使用以下代码将css更新附加到afterShowForm表单编辑事件:

I attached a css update to the afterShowForm Form Editing event, using the following code:

afterShowForm: function(form) { form.css("height", "300px"); }

请注意,300px是我选择进行测试的任意数字.该数字将进行调整以满足我的需求.甚至可以在调整大小时进行动态调整.谁知道.

Mind you, 300px is an arbitrary number that I selected for testing. That number will be tweaked to fit my needs. It may even be dynamically adjusted on resizing. Who knows.

此外,使用Firebug,我发现我的表单ID为 FrmGrid_list .我的网格ID是列表(例如<table id="list"></table>jQuery("#list").jqGrid({...});).如果您的网格被命名为list以外的其他名称,则表单ID(上面)应该反映出来.

Also, using Firebug I found that my form id is FrmGrid_list. My grid id is list (e.g. <table id="list"></table> and jQuery("#list").jqGrid({...});). If your grid is named something other than list, the form id (above) should reflect that.

参考链接:

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

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