mirror of
https://github.com/RetroShare/RSNewWebUI.git
synced 2026-09-14 11:05:47 +05:00
fix searchbar reset on redraw
This commit is contained in:
parent
73c609578a
commit
f5ea8e59cd
@ -56,6 +56,11 @@ let Downloads = {
|
||||
updateFileDetail(hash);
|
||||
}
|
||||
},
|
||||
resetSearch() {
|
||||
for(let hash in Downloads.statusMap) {
|
||||
Downloads.statusMap[hash].isSearched = true;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
function InvalidFileMessage() {
|
||||
@ -114,13 +119,16 @@ NewFileDialog = () => {
|
||||
|
||||
const Component = () => {
|
||||
return {
|
||||
oninit: () => rs.setBackgroundTask(
|
||||
Downloads.loadStatus,
|
||||
1000,
|
||||
() => {
|
||||
return (m.route.get() === '/files')
|
||||
}
|
||||
),
|
||||
oninit: () => {
|
||||
rs.setBackgroundTask(
|
||||
Downloads.loadStatus,
|
||||
1000,
|
||||
() => {
|
||||
return (m.route.get() === '/files')
|
||||
}
|
||||
);
|
||||
Downloads.resetSearch();
|
||||
},
|
||||
view: () => m('.widget', [
|
||||
m('h3', 'Downloads'),
|
||||
m('hr'),
|
||||
|
||||
@ -127,8 +127,8 @@ const File = () => {
|
||||
}
|
||||
};
|
||||
|
||||
let searchString = '';
|
||||
const SearchBar = () => {
|
||||
let searchString = '';
|
||||
return {
|
||||
view: (v) =>
|
||||
m('input[type=text][placeholder=search].searchbar', {
|
||||
@ -136,7 +136,8 @@ const SearchBar = () => {
|
||||
oninput: (e) => {
|
||||
searchString = e.target.value.toLowerCase();
|
||||
for(let hash in v.attrs.list) {
|
||||
if(v.attrs.list[hash].fname.toLowerCase().indexOf(searchString) > -1) {
|
||||
if(v.attrs.list[hash].fname.toLowerCase().indexOf(
|
||||
searchString) > -1) {
|
||||
v.attrs.list[hash].isSearched = true;
|
||||
} else {
|
||||
v.attrs.list[hash].isSearched = false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user