javascript - jsGrid中的自动调整大小的列
问题描述
我正在玩 jsGrid,只剩下一个问题要解决:当我定义网格列时,我为除一列之外的所有列指定宽度。
fields: [
{ name: "Name", type: "text", title: "Naziv" },
{ name: "Mbs", type: "text", width: 24, title: "MBS" },
{ name: "PB", type: "text", width: 23, title: "PB" },
{ name: "OIB", type: "text", width: 34, title: "OIB" },
{ name: "Country", type: "text", width: 35, title: "Država" },
{ name: "City", type: "text", width: 35, title: "Grad" },
{ name: "ActiveFrom", type: "text", width: 28, title: "Od" },
{ name: "ActiveTo", type: "text", width: 28, title: "Do" },
{ name: "Active", type: "checkbox", width:10, title: "A" }
],
问题是第一个字段设置为100px,然后浏览器根据指定的宽度计算所有列的宽度,导致浏览器窗口宽度变化时列宽发生变化。
我曾尝试将该列宽设置为“auto”和“*”,但随后,该列占据了表格的 90%,其他列的宽度为 10px(但 css 显示了我之前定义的宽度)
有谁知道这个问题的解决方案?
解决方案
在尝试呈现表格之前,必须至少将一列宽度设置为“自动”。如果未设置宽度,则默认为 100 像素,从而破坏了所需的外观。
只是我的运气。我在如此琐碎的事情上浪费了一个小时,当我决定在这里提问时,我找到了解决方案并希望删除这个问题的耻辱。
推荐阅读
- arrays - 将 pyaudio 数据块组合成一个较长的块
- python - 构建 CNN 模型后,如何从图像或视频中制作边界框.. 提前致谢
- javascript - PDFTron focusout() 中的自由文本工具
- php - 如何在 Joomla 自定义组件中设置“记住我”cookie?
- ios - 尝试运行我的 React Native 应用程序时遇到问题
- android - 什么是 Android 中的“HAL 远程处理”?
- r - 如何在 R 的 GAM 回归中绘制拟合曲线?
- python - 通过 Python-Selenium Web Driver 抓取 Quora 上某个问题下发布的答案的永久链接
- java - 在 Java 中实现 RTSP 服务器以在 VLC 媒体播放器上流式传输视频
- javascript - 当模式中的验证匹配 false 时,Mongoose 不会抛出错误