Vuetify Align footer columns with table columns in data table

ⅰ亾dé卋堺 提交于 2020-04-16 02:52:22

问题


I have a datatable (vuetify 2.1.12) with slot="items" and slot="footer". In the footer I wan't to display the sum of some of the columns. The "problem" is that the columns in the footer are not at all in line with the columns in the table.

basically I do this in the data table:

             <template v-slot:item="props">
                <tr>
                  <td>{{ props.item.qty }}</td>
                  <td>{{ props.item.qtyBoughtToday }}</td>
                  <td>{{ props.item.shortName }}</td>
                </tr>
              </template>
              <template slot="footer">
                <tr>
                  <td></td>
                  <td>{{ sumQtyBoughtToday }}</td>
                  <td></td>
                </tr>
             </template>

The thing is that the footer column "sumQtyBoughtToday" does not end up in the same place at all as the column props.item.qtyBoughtToday.

So...how to accomplish it?


回答1:


I think you're looking for the body.append slot instead of the footer...

 <template slot="body.append">
      <tr>
          <td></td>
          <td>{{ sumQtyBoughtToday }}</td>
          <td></td>
      </tr>
 </template>

Example: https://codeply.com/p/kIlxX2jTZ1



来源:https://stackoverflow.com/questions/60951401/vuetify-align-footer-columns-with-table-columns-in-data-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!