css - 如何更改 handsontable 行标题宽度?

标签 css header width row handsontable

我无法使用可操作电子表格更改行标题的宽度。 我试过这篇文章中引用的 CSS:Handsontable increase row header width : 从我读过的内容来看,你不能像列一样使用 rowWidths,但你必须进入行标题本身的 CSS。

.handsontable col.rowHeader {
    width: 180px;
}

Picture of the problem .

CSS 在这里:

html {
    background-color: #e6e9e9;
    background-image: -webkit-linear-gradient(270deg,rgb(230,233,233) 0%,rgb(216,221,221) 100%);
    background-image: linear-gradient(270deg,rgb(230,233,233) 0%,rgb(216,221,221) 100%);
    -webkit-font-smoothing: antialiased;
}

body {
    margin: 0 auto;
    padding: 2em 2em 4em;
    max-width: 800px;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5em;
    color: #545454;
    background-color: #ffffff;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.06);
}


a {
  color: #34A9DC;
  text-decoration: none;
}

p {
  margin: 5px 0 20px;
}

h4 {
  margin: 20px 0 0;
  font-size: 22px;
  font-weight: normal;
}


.topcorner {
    position:relative;
        float:right;
        top:0px;
        right:16px;
}

#total {
    font-size: 20px;
    margin: 2 auto;
    padding: 4em 4em 4em;
}


.handsontable col.rowHeader {
    width: 180px;
}`

这是电子表格的 JS:

var hot = new Handsontable(container,
 {
    data: getData(),
    colHeaders: ["Quantity","Cost","Amount"],
    rowHeaders: ["Flights",
                 "Taxi & Bus",
                 "Hotel(nights, cost/night)",
                 "Breakfast & Lunch",
                 "Dinners",
                 "Museum Tickets",
                 "Live Show Tickets",
                 "Driving(miles, cost/mile)"],
    manualColumnResize: true,
    columns: [
      {
        data: 'quantity',
        type: 'numeric',
        language: 'en'
      },
        {
        data: 'cost',
        type: 'numeric',
        format: '$0,0.00',
        language: 'en'
      },
        {
        data: 'amount',
        type: 'numeric',
        format: '$0,0.00',
        language: 'en'
      }
    ],
        colWidths:[80,120,150]

  });

我正在使用的 HTML div:<div id="example" class="handsontable"></div>

最佳答案

您没有提供足够的信息。我只能建议要么;

  • 您的 CSS 不够具体,并且没有覆盖 handsontable 库附带的任何 CSS
  • 您使用了错误的选择器,因此未应用 CSS。

编辑:你能试试下面的 CSS 吗?

.ht_clone_left.handsontable tbody tr th { width: 180px; }

关于css - 如何更改 handsontable 行标题宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35570263/

相关文章:

header - 如何添加 Access-Control-Allow-Origin header

html - 如何将表格的宽度设置为窗口的宽度

wpf - 如何在 XAML 中根据窗口或屏幕大小设置网格列最大宽度

WPF 组框控件模板 : How to apply a Style only to elements in the Header?

javascript - 在具有属性表布局 : fixed 的表中调整窗口大小时更改宽度

javascript - 如何使用 Javascript 防止随机生成的图像重叠

javascript - 为什么这个网站在 IE 7 中卡住,但在任何其他浏览器中都没有?

html - 同时具有半径和箭头的 CSS 按钮,可能吗?

css - 如何隐藏除 id=mainContainer 之外的所有元素

php - 从 PHP cURL 响应中获取 header