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

how to cacel all checkbox on DataTable


please let me know how to use code to cancel, clear all of checkbox on DataTable. not show in KTUI guide.
Thank you


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 (1)


Hi Xin Yu

After the table is initialised, get the instance and call uncheck():


const tableEl = document.querySelector("#your_datatable");
const datatable = KTDataTable.getInstance(tableEl);

if (datatable) {
datatable.uncheck();
}


Related methods:

check() — selects all visible row checkboxes
getChecked() — array of checked row IDs
update() — refreshes checkbox UI after tbody changes (pagination, reload)
With default checkbox.preserveSelection: true, uncheck() clears the current page and drops those IDs from the stored selection; other pages may still have IDs in getChecked(). To clear everything in one go, use preserveSelection: false when creating the instance, then uncheck():


const datatable = new KTDataTable(tableEl, {
checkbox: { preserveSelection: false },
// ...your other options
});

// later, to clear all:
datatable.uncheck();


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  :(