diff --git a/internal/js/files_support.js b/internal/js/files_support.js index 5a8a90a..39e7cd3 100644 --- a/internal/js/files_support.js +++ b/internal/js/files_support.js @@ -567,7 +567,7 @@ function getPageFileList(res, viewingIdx) function getEntriesByIdSuccessHandler(res,pageNumber,successCallback,viewingIdx) { if( res.length != pageList.length ) - document.alert="WARNING: something in data has changed since viewing this page (likely someone deleted content in another view), strongly suggest a page reload to get the latest data" + document.alert="WARNING: something has changed since viewing this page (likely someone deleted content in another view), strongly suggest a page reload to get the latest data" document.entries=res; // cache this @@ -595,7 +595,7 @@ function getPage(pageNumber, successCallback, viewingIdx=0) const startIndex = (pageNumber - 1) * OPT.how_many; const endIndex = startIndex + OPT.how_many; pageList = entryList.slice(startIndex, endIndex); - + // set up data to send to server to get the entry data for entries in pageList data={} data.ids = pageList @@ -700,7 +700,11 @@ function isMobile() { // when we change one of the options (noo, how_many, folders) - then update '{how_many} files' str, // tweak noo menu for folders/flat view then reset the page contents based on current OPT values function changeOPT(successCallback) { + var old_how_many=OPT.how_many OPT.how_many=$('#how_many').val() + // if we change how_many invalidate page cache as page size is different now + if( OPT.how_many != old_how_many ) + document.page.length=0 new_f=$('#folders').val() new_f=( new_f == 'True' ) // if change to/from folders, also fix the noo menu @@ -729,9 +733,10 @@ function changeOPT(successCallback) { contentType: 'application/json', success: function(resp) { entryList=resp.query_data.entry_list + OPT.how_many=parseInt(OPT.how_many) + pageList=entryList.slice(0, OPT.how_many) // put data back into booleans, ints, etc OPT.folders=( OPT.folders == 'True' ) - OPT.how_many=parseInt(OPT.how_many) $('.how_many_text').html( ` ${OPT.how_many} files ` ) OPT.size=parseInt(OPT.size) getPage(1,successCallback)