bootstrap-table icon indicating copy to clipboard operation
bootstrap-table copied to clipboard

On Data Change Event

Open yagiz2000 opened this issue 2 years ago • 4 comments

Description

Hi,

In some cases you may want to track table's data when it has been loaded or changed. For that case I want to create new event called onDataChanged.

What do you think about this feature is it necessary or redundant feature ? If you think it is a nice feature I want to implement that new event

yagiz2000 avatar Jul 15 '23 10:07 yagiz2000

Can you provide some use cases? I'm unsure if I need this event because there is already an onLoadSuccess event in server-side pagination. If you use the load method to update the data in client-side pagination, you also know that the data has changed.

wenzhixin avatar Jul 19 '23 15:07 wenzhixin

Sure, For example you need to make conditional rendering depending on tables data, then you need listen data instantly, to do that i do not want to execute .getData() method all the time.

<script setup>
import { ref, computed } from 'vue'
const templateRepos = ref([])

const isDefaultExists = computed(() =>
  templateRepos.value.some(templateRepo => templateRepo.isDefault === true)
)
</script>
<template> 
<div>
 <datatable
      @on-data-changed="data => (templateRepos = data)"
    ></datatable>

</div>

</template>

yagiz2000 avatar Jul 19 '23 16:07 yagiz2000