Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

Vue Ktdatable


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>


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (5)


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:


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(