Christmas Sale! Limited Time Only - Enjoy 30% Off Metronic Extended License!
Buy for 669$  969$

KTDataTable v9.1.1 Hotfixes


Here are two hotfixes for the recent Datatable issue:

1. Persist Search Input Value After Page Refresh
In the /src/core/components/datatable/datatable.ts file, modify the _attachSearchEvent function.

Add the following lines after the searchElement declaration:

const searchElement: HTMLInputElement | null = document.querySelector<HTMLInputElement>(`[data-datatable-search="#${tableId}"]`);

// Get search state
const { search } = this.getState();

// Set search value
searchElement.value = typeof search === "string" ? search : String(search);


This will fix the search input retains its value after refreshing the page.

2. Display Error Message When Search Yields No Results
In the same file (datatable.ts), update the _noticeOnTable function.

Find this line:

const row = this._tbodyElement.insertRow();

Replace it with:

const row = this._tableElement.tBodies[0].insertRow();


This modification addresses the issue where the "infoEmpty" message does not display when the search is empty, so the message appears correctly.

These tweaks should help resolve the issues.


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