i want to disable sort after add item or re-init ktdatatabe like first time ,
an disable pagination.
<KTDatatable :table-data="tableData" :table-header="tableHeader" :enable-items-per-page-dropdown="false" :rows-per-page="100" :items-per-page-change="100" :sort-label="level">
<template v-slot:cell-level="{ row: teacher }">
{{ teacher.level }}
</template>
<template v-slot:cell-name="{ row: teacher }">
{{ teacher.name }}
</template>
<template v-slot:cell-nick_name="{ row: teacher }">
{{ teacher.nick_name }}
</template>
</KTDatatable>
Hi Moaz,
To disable a sort by setting a sortable: false
in your header column configuration array.
If you want to display all items without pagination you can set rows-per-page props to tableData.length.
:rows-per-page="tableData.length"
when I add a new item, want it to place in the correct index in the table, as I sort.
like when I sort [1,2,4] then add 3, will be like [1,2,3,4], in my case when adding a new item look like [1,2,4,3]
Could you please attach a code on how you are adding new items?
using vuex (module)
const formSubmit = () => {
store.dispatch(Actions.ADD_TEACHER, formData.value)
}
@Action
[Actions.ADD_TEACHER](Teacher) {
Teacher.id = null
return ApiService.post("teacher", Teacher)
.then(({data}) => {
this.teachers.push(data)
})
.catch(({response}) => {
this.context.commit(Mutations.SET_ERROR_OF_ADD_TEACHER, true);
toast.error(response.data.message);
});
}
Hi,
Oh, it looks like these cases are not handled by our component, we will include a fix for it in an upcoming release.
For now, you can handle sorting on your server or use the array-sort plugin to sort the array manually.
Check array-sort plugin:
https://www.npmjs.com/package/array-sort