You can't return anything from the done callback of a promise object. Instead, you should use .then and return the original deferred from the function so that you will have a deferred object.
FormHelper.prototype.foldUnfoldForm = function($container, state) {
return main.addressDAO.get(debtorCasePath, viewEntityId).then(function(address) {
return brite.display('case/' + state + 'AddressView', $container, address).done(function() {
$container.children().unwrap();
})
});
};
This assumes main.addressDAO.get()
is returning a jquery promise object. If it isn't then we'll need to know what kind of promise/deferred object it is returning.