$.getJSON already returns a promise like object
... so no need to create a deferred object separately and then resolve it manually. This is since jquery 1.5 See: https://api.jquery.com/jquery.getjson/
This commit is contained in:
parent
f3e7211ee5
commit
c80a31ebe0
@ -80,7 +80,6 @@ $.widget('oc.documentGrid', {
|
|||||||
|
|
||||||
_load : function (fileId){
|
_load : function (fileId){
|
||||||
var that = this;
|
var that = this;
|
||||||
var def = new $.Deferred();
|
|
||||||
var url = 'apps/richdocuments/ajax/documents/list';
|
var url = 'apps/richdocuments/ajax/documents/list';
|
||||||
var dataObj = {};
|
var dataObj = {};
|
||||||
if (fileId){
|
if (fileId){
|
||||||
@ -88,7 +87,7 @@ $.widget('oc.documentGrid', {
|
|||||||
dataObj = { fileId: fileId };
|
dataObj = { fileId: fileId };
|
||||||
}
|
}
|
||||||
|
|
||||||
$.getJSON(OC.generateUrl(url, dataObj))
|
return $.getJSON(OC.generateUrl(url, dataObj))
|
||||||
.done(function (result) {
|
.done(function (result) {
|
||||||
if (!result || result.status === 'error') {
|
if (!result || result.status === 'error') {
|
||||||
documentsMain.loadError = true;
|
documentsMain.loadError = true;
|
||||||
@ -108,12 +107,10 @@ $.widget('oc.documentGrid', {
|
|||||||
that.options.sessions = result.sessions;
|
that.options.sessions = result.sessions;
|
||||||
that.options.members = result.members;
|
that.options.members = result.members;
|
||||||
}
|
}
|
||||||
def.resolve();
|
|
||||||
})
|
})
|
||||||
.fail(function(data){
|
.fail(function(data){
|
||||||
console.log(t('richdocuments','Failed to load documents.'));
|
console.log(t('richdocuments','Failed to load documents.'));
|
||||||
});
|
});
|
||||||
return def;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_render : function (data){
|
_render : function (data){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user