fix: Return a file element even if the rendered list does not contained one

Signed-off-by: Julius Härtl <jus@bitgrid.net>
Julius Härtl 3 weeks ago
parent 6a045e379f
commit d59567d06e
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF

@ -1357,8 +1357,18 @@
* @return {Object} jQuery object of the matching row
*/
findFileEl: function(fileName){
// use filterAttr to avoid escaping issues
return this.$fileList.find('tr').filterAttr('data-file', fileName);
var fileRow = this.$fileList.find('tr').filterAttr('data-file', fileName);
if (fileRow.length) {
return fileRow;
}
// The row we try to get might not have been rendered due to pagination,
// so in case we find the file in the file list return the rendered row instead
var fileData = this.files.find(function (el){
return el.name === fileName;
});
return fileData ? this._renderRow(fileData, {updateSummary: false, silent: true}) : fileRow;
},
/**

Loading…
Cancel
Save