【问题标题】:PrimeVue - is there any way to hide the row selection column in the DataTable component?PrimeVue - 有没有办法隐藏 DataTable 组件中的行选择列?
【发布时间】:2021-04-28 11:33:24
【问题描述】:

我正在寻找一种方法来有条件地隐藏 DataTable 组件中的行选择列,例如,如果我传递了某个 prop,我想渲染它:

<DataTable>
  <Column v-if="propName == true" :selectionMode="selectedMode" headerStyle="width: 3em"></Column>
</DataTable>

但是,当我尝试执行上述操作时,我的表格会随机呈现 4 个空列。

screenshot of what I want to conditionally hide

what happens when I try to do use the v-if directive

【问题讨论】:

    标签: vue.js vuejs2 primevue


    【解决方案1】:

    最终我设法使用 CSS 样式修复它,以有条件地隐藏我想要的列。

    :style="useRowEditing === false ? 'display: none;' : ''"
    

    刚刚将其添加到列中,并将附加属性传递给我的数组中的列。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-19
      • 1970-01-01
      • 2021-01-14
      • 1970-01-01
      • 2016-10-17
      • 1970-01-01
      • 2015-04-01
      • 1970-01-01
      相关资源
      最近更新 更多