KTDataTable v9.1.1 Hotfixes
Here are two hotfixes for the recent Datatable issue:
- 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(`[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.
- 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.
Replies (0)
There is no reply for this question at the moment. Be first to leave a reply.