Empty message template

pull/12/head
cagataycivici 2019-06-29 14:47:14 +03:00
parent ac26548df2
commit 1ee86c976e
2 changed files with 13 additions and 6 deletions

View File

@ -23,10 +23,17 @@
</tr>
</thead>
<tbody class="p-datatable-tbody">
<tr class="p-datatable-row" v-for="(rowData, index) of data" :key="getRowKey(rowData, index)">
<td v-for="(col,i) of columns" :key="col.columnKey||col.field||i" :style="col.bodyStyle" :class="col.bodyClass">
<ColumnSlot :data="rowData" :column="col" type="body" v-if="col.$scopedSlots.body" />
<template v-else>{{resolveFieldData(rowData, col.field)}}</template>
<template v-if="!empty">
<tr class="p-datatable-row" v-for="(rowData, index) of data" :key="getRowKey(rowData, index)">
<td v-for="(col,i) of columns" :key="col.columnKey||col.field||i" :style="col.bodyStyle" :class="col.bodyClass">
<ColumnSlot :data="rowData" :column="col" type="body" v-if="col.$scopedSlots.body" />
<template v-else>{{resolveFieldData(rowData, col.field)}}</template>
</td>
</tr>
</template>
<tr v-else class="p-datatable-emptymessage">
<td :colspan="columns.length">
<slot name="empty"></slot>
</td>
</tr>
</tbody>
@ -217,7 +224,7 @@ export default {
}
else
return null;
},
}
},
components: {
'ColumnSlot': ColumnSlot,

View File

@ -32,7 +32,7 @@
</template>
</Column>
<template #footer>
In total there are {{cars.length}} cars.
In total there are {{cars ? cars.length : 0 }} cars.
</template>
</DataTable>
</div>