Ensured that the default container options are used if no configuration has been defined
This commit is contained in:
@@ -29,16 +29,21 @@ function listViewController($rootScope, $scope, $routeParams, $injector, notific
|
||||
items: []
|
||||
};
|
||||
|
||||
// Set default default options (i.e. those if no container configuration has been saved)
|
||||
$scope.options = {
|
||||
pageSize: 10,
|
||||
pageNumber: 1,
|
||||
filter: '',
|
||||
orderBy: 'UpdateDate',
|
||||
orderDirection: "desc"
|
||||
};
|
||||
|
||||
// Retrieve the container configuration for the content type and set options before presenting initial view
|
||||
contentTypeResource.getContainerConfig($routeParams.id)
|
||||
.then(function (config) {
|
||||
$scope.options = {
|
||||
pageSize: config.pageSize,
|
||||
pageNumber: 1,
|
||||
filter: '',
|
||||
orderBy: 'UpdateDate',
|
||||
orderDirection: "desc"
|
||||
};
|
||||
if (typeof(config.pageSize) !== 'undefined') {
|
||||
$scope.options.pageSize = config.pageSize;
|
||||
}
|
||||
|
||||
$scope.initView();
|
||||
});
|
||||
|
||||
@@ -41,7 +41,12 @@ namespace Umbraco.Web.Editors
|
||||
throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||
}
|
||||
|
||||
return JsonConvert.DeserializeObject<ContentTypeContainerConfiguration>(contentItem.ContentType.ContainerConfig);
|
||||
if (!string.IsNullOrEmpty(contentItem.ContentType.ContainerConfig))
|
||||
{
|
||||
return JsonConvert.DeserializeObject<ContentTypeContainerConfiguration>(contentItem.ContentType.ContainerConfig);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user