Hello,
I’m trying to develop an app that shows a file list but can’t get it working. The app won’t initialize and the following error shows up in the browser console:
14:55:42.705 An tab with the same id versionsTabView already existsObject { _id: "versionsTabView", _name: "Versions", _icon: "icon-history", _mount: mount(el, fileInfo), _update: update(fileInfo), _destroy: destroy(), _enabled: canDisplay(e), _scrollBottomReached: s()
}
[sidebar.js:270:296]
registerTab sidebar.js:270
registerTabView filelist.js:3738
attach filesplugin.js:41
attach main.js:332
initialize filelist.js:438
initialize files_advancedsearch.js:85
e files_advancedsearch.js:85
initialize files_advancedsearch.js:85
<anonymous> files_advancedsearch.js:85
ot main.js:27
(Async: setTimeout handler)
ot main.js:27
o main.js:27
Xe main.js:27
i main.js:27
<anonymous> files_advancedsearch.js:85
(Async: EventListener.handleEvent)
<anonymous> files_advancedsearch.js:85
r files_advancedsearch.js:1
<anonymous> files_advancedsearch.js:1
<anonymous> files_advancedsearch.js:1
Here’s the code:
if (!OCA.AdvancedSearch) {
OCA.AdvancedSearch = {}
}
OCA.AdvancedSearch.App = {
_initialized: false,
initialize: function($el) {
if (this._initialized) {
return
}
var fileActions = new OCA.Files.FileActions()
fileActions.registerDefaultActions()
fileActions.merge(OCA.Files.FileActions)
console.log('*******************')
this.fileList = new OCA.AdvancedSearch.FileList(
$el,
{
config: OCA.Files.App.getFilesConfig(),
fileActions,
}
)
console.log('*******************')
this._initialized = true
}
}
window.addEventListener('DOMContentLoaded', function() {
(function(OCA) {
var AdvancedSearchFileList = function($el, options) {
this.initialize($el, options)
}
AdvancedSearchFileList.prototype = _.extend({}, OCA.Files.FileList.prototype,{
id: 'advanced-search-results',
appName: 'Advanced search',
initialize: function($el, options) {
OCA.Files.FileList.prototype.initialize.apply(this, arguments)
if (this.initialized) {
return
}
OC.Plugins.attach('OCA.AdvancedSearch.FileList', this)
}
})
OCA.AdvancedSearch.FileList = AdvancedSearchFileList
})(OCA)
_.defer(function() {
OCA.AdvancedSearch.App.initialize($('#advanced-search'))
})
})
The error occurs when creating the new OCA.AdvancedSearch.FileList object and I’ve no idea what’s going on (why is it even trying to register a versionsTabView tab?).
Coud someone help me a bit?
Regards,
Cyrille