简体   繁体   English

如何冻结表的第一列?

[英]How to freeze first column of the table?

I have a table which is implemented by making use of jquery EasyUI . 我有一个通过使用jQuery EasyUI实现的表。 I want first column of the table to be freezed and remaing column should have scrollbar when the page is in smaller screen. 我希望冻结表的第一列,并且当页面位于较小的屏幕中时,remaing列应具有滚动条。 Code Here snippet 此处的代码段

How can I freeze only Title1 column. 如何只冻结Title1列。

I tried adding that Title1 column in Datagrid-view1 to achieve this. 我尝试在Datagrid-view1添加Title1列以实现此目的。 But I couldn't able to find proper solution ..Thanks in advance 但是我找不到合适的解决方案..谢谢

The documentation you're looking for is here: https://www.jeasyui.com/documentation/index.php 您正在寻找的文档在这里: https : //www.jeasyui.com/documentation/index.php

According to the documentation, you're looking for the frozenColumns option. 根据文档,您正在寻找frozenColumns选项。 You take the columns you want frozen out of the columns section and add them in frozenColumns . 您可以从“ columns部分中取出要冻结的columns ,并将其添加到frozenColumns

Something like this: 像这样:

frozenColumns: [[
    {field:'f1',title:'title1',width:100,editor:'text'},
]],
columns:[[
    {field:'f2',title:'title2',width:100,editor:'text'},
    {field:'f3',title:'title3',width:100,editor:'text'},
    {field:'f4',title:'NotSave',width:50,
    editor:{type:'checkbox',options:{on:1,off:0}}}
]],

You also need to turn off fitColumns . 您还需要关闭fitColumns

fitColumns: false,

With these settings I get a horizontal scrollbar in the code you put up. 有了这些设置,我在放置的代码中得到了一个水平滚动条。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM