From b095fe6bdfc3722006435411d60f97d1d15de550 Mon Sep 17 00:00:00 2001 From: Richard Bradley Date: Wed, 15 Jun 2016 13:49:18 +0100 Subject: [PATCH] #372 allow sortable(false) on fields in list view --- doc/API-mapping.md | 2 ++ doc/reference/Field.md | 6 +++++- package.json | 2 +- src/javascripts/ng-admin/Crud/list/maDatagrid.js | 5 ++++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/API-mapping.md b/doc/API-mapping.md index d65f6f2a..db2fb197 100644 --- a/doc/API-mapping.md +++ b/doc/API-mapping.md @@ -205,6 +205,8 @@ myApp.config(['RestangularProvider', function(RestangularProvider) { }]); ``` +(If a column is not sortable by your backend, e.g. a computed column, you can disable sorting per-column using [`Field.sortable(false)`](reference/Field.md#general-field-settings).) + ## Filtering All filter fields are added as a serialized object passed as the value of the `_filters` query parameter. For instance, the following `filterView()` configuration: diff --git a/doc/reference/Field.md b/doc/reference/Field.md index 74247379..73be76c7 100644 --- a/doc/reference/Field.md +++ b/doc/reference/Field.md @@ -53,7 +53,11 @@ Create a new field of the given type. Default type is 'string', so you can omit Define the label of the field. Defaults to the uppercased field name. * `editable(boolean)` -Define if the field is editable in the edition form. Usefult to display a field without allowing edition (e.g for creation date). +Define if the field is editable in the edition form. Useful to display a field without allowing edition (e.g for creation date). + +* `sortable(boolean)` +Define if the field is sortable in the list view (default `true`). +(See ["Sort Columns and Sort Order"](../API-mapping.md#sort-columns-and-sort-order) for a discussion of how to integrate `ng-admin` sorting with your REST backend.) * `order(number|null)` Define the position of the field in the view. diff --git a/package.json b/package.json index 883c9b1a..3c274634 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "url": "git://github.com/marmelab/ng-admin.git" }, "devDependencies": { - "admin-config": "^0.11.0", + "admin-config": "^0.12.0", "angular": "~1.4.8", "angular-mocks": "~1.4.8", "angular-numeraljs": "^1.1.6", diff --git a/src/javascripts/ng-admin/Crud/list/maDatagrid.js b/src/javascripts/ng-admin/Crud/list/maDatagrid.js index ff3207b9..58fa37f8 100644 --- a/src/javascripts/ng-admin/Crud/list/maDatagrid.js +++ b/src/javascripts/ng-admin/Crud/list/maDatagrid.js @@ -26,10 +26,13 @@ export default function maDatagrid() { - + {{ field.label() | translate }} + + {{ field.label() | translate }} +