Get 2024 Templates Mega Bundle!$1000 worth of 19 Bootstrap HTML, Vue & React Templates + 3 Vector Sets for just $99
Get for 99$

Metronic 8 Vue - KTDatatable - col/s summary


Hi Lauris,

I know that currently datatables does`n have such a functionality but ... can you please give me a tip how to expand this to have opportunity to summarize column(s) e.g. table like NAME, SURNAME, SALES, EARNINGS.
I`d like to have additional row at the bottom of the table with sum either SALES, EARNINGS each below proper column

regards
Krystian


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (3)


Hi Lauris,

this is great.
Thank you



Hi Krystian,

Glad to hear that. Please don't hesitate to reach out if you need anything more from us.

Regards,
Lauris Stepanovs,
Keenthemes Support Team


Your Support Matters!

We will highly appreciate your Metronic Review on Themeforest.
Please go to Themeforest Downloads page, select Metronic & leave your feedback.

Hi Krystian,

Firstly, you can expand src/components/kt-datatable/table-partials/table-content/table-body/TableBodyRow.vue.

<template>
<tbody class="fw-semibold text-gray-600">
<template v-for="(row, i) in data" :key="i">
<tr>
<td v-if="checkboxEnabled">
<div
class="form-check form-check-sm form-check-custom form-check-solid"
>
<input
class="form-check-input"
type="checkbox"
:value="row[checkboxLabel]"
v-model="selectedItems"
@change="onChange"
/>
</div>
</td>
<template v-for="(properties, j) in header" :key="j">
<td :class="{ "text-end": j === header.length - 1 }">
<slot :name="`${properties.columnLabel}`" :row="row">
{{ row }}
</slot>
</td>
</template>
</tr>
</template>
<tr>
<template v-for="(properties, j) in header" :key="j">
<td v-if="properties.totalEnabled" :class="{ "text-end": j === header.length - 1 }">
Total: <strong>{{ properties.totalValue }}</strong>
</td>
<td v-else></td>
</template>
</tr>
</tbody>
</template>


Then in your header configuration, you can add properties to enable the total cell at the end of the table.

{
columnName: "sales",
columnLabel: "sales",
totalEnabled: true,
totalValue: <enter your total value here>,
},


Regards,
Lauris Stepanovs,
Keenthemes Support Team


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(