You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My table uses data-filter-control="true" and data-show-search-clear-button="true". I also use localStorage for saving my own cookies, nothing to do with bootstrap table. I have found that using the clear search button while localStorage contains cookies the following error is shown:
As the error says, the problem is found in the following piece of code from Cookie extension:
because t._storage is undefined. Adding data-cookie="true" to the table makes the error go away because t._storage is not undefined, but this is not the point, since cookies should not be tried to be deleted if the table works without cookies.
I made some debugging to know why cookies are being deleted if my table does not use cookies, and found out that collectBootstrapTableFilterCookies function, from Filter Control extension, is returning the cookies stored in localStorage even when they have nothing to do with bootstrap table. Specifically the code that is causing so is:
if (foundLocalStorage) {
for (var i = 0; i < foundLocalStorage.length; i++) {
var cookie = foundLocalStorage.key(i);
if (/./g.test(cookie)) {
cookie = cookie.split('.').pop();
}
if (!cookies.includes(cookie)) {
cookies.push(cookie);
}
}
}
The problem is that any cookie's name stored in localStorage is returned by this method and afterwards those cookies will be deleted.
Example(s)
I tried to reproduce it in the online editor but couldn't.
Possible Solutions
I think that changing the regular expression so it only matches with bootstrap-table cookies would solve the problem:
if (foundLocalStorage) {
for (var i = 0; i < foundLocalStorage.length; i++) {
var cookie = foundLocalStorage.key(i);
if (/.bs\.table\../.test(cookie)) {
cookie = cookie.split('.').pop();
}
if (!cookies.includes(cookie)) {
cookies.push(cookie);
}
}
}
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Bootstraptable version(s) affected
1.22.4
Description
My table uses
data-filter-control="true"
anddata-show-search-clear-button="true"
. I also uselocalStorage
for saving my own cookies, nothing to do with bootstrap table. I have found that using the clear search button whilelocalStorage
contains cookies the following error is shown:As the error says, the problem is found in the following piece of code from Cookie extension:
because
t._storage
is undefined. Addingdata-cookie="true"
to the table makes the error go away becauset._storage
is not undefined, but this is not the point, since cookies should not be tried to be deleted if the table works without cookies.I made some debugging to know why cookies are being deleted if my table does not use cookies, and found out that
collectBootstrapTableFilterCookies
function, from Filter Control extension, is returning the cookies stored inlocalStorage
even when they have nothing to do with bootstrap table. Specifically the code that is causing so is:The problem is that any cookie's name stored in
localStorage
is returned by this method and afterwards those cookies will be deleted.Example(s)
I tried to reproduce it in the online editor but couldn't.
Possible Solutions
I think that changing the regular expression so it only matches with bootstrap-table cookies would solve the problem:
Additional Context
No response
The text was updated successfully, but these errors were encountered: