how to add scrollbars to jqgrid view window and re

2019-02-15 07:59发布

If table contains big multi-line text column, pressing jqgrid view toolbar button creates view window with big height and without scrollbar. Most of data is outside screen and is not visible.

I tried to add scrollbars and restrict its height using

jQuery.extend(jQuery.jgrid.view, {
   savekey: [true, 13],
   recreateForm: true,
   closeOnEscape: true,
   dataheight: screen.height-230,
   height: 0.82* screen.height,
   width: 0.96*screen.width,
   top:5
     });

but those settings are ignored ( they work for edit window only if jQuery.jgrid.edit is used).

How to add scrollbar(s) and retrict view window height if it contains more data than fits to screen ?

标签: jqgrid
1条回答
聊天终结者
2楼-- · 2019-02-15 08:43

I suggest to get the demo from the answer and extend the code a little. In the method beforeShowForm I suggest to include additional line

$(this).children("span").css({
    overflow: "auto",
    "text-align": "inherit", // overwrite 'text-align: "right"' if exist
    display: "inline-block",
    "max-height": "100px"
});

You can see the results on the demo. The height of the View form will be variable, but the maximal height of every field will be restricted to 100px (see max-height above):

enter image description here

or

enter image description here

查看更多
登录 后发表回答