Skip to content

Commit

Permalink
marmelab#372 allow disableSort on fields in list view
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardBradley committed Mar 17, 2016
1 parent 8636a9c commit 070f9d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions doc/reference/Field.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ Define the default value of the field in the creation form.
* `pinned(boolean)`
Whether the field should always appear. Used in filters (see listView Settings). Default to false.

* disableSort = boolean
Set this property to true to prevent the user from sorting on this field in the list view.
(Note this is a boolean property, not a setter function taking a boolean param).

## `wysiwyg` Field Type

* `stripTags(boolean)`
Expand Down
5 changes: 4 additions & 1 deletion src/javascripts/ng-admin/Crud/list/maDatagrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ export default function maDatagrid() {
<ma-datagrid-multi-selector toggle-select-all="toggleSelectAll()" selection="selection" entries="entries"/>
</th>
<th ng-repeat="field in fields() track by $index" ng-class="field.getCssClasses()" class="ng-admin-column-{{ ::field.name() }} ng-admin-type-{{ ::field.type() }}">
<a ng-click="datagrid.sortCallback(field)">
<a ng-if="!field.disableSort" ng-click="datagrid.sortCallback(field)">
<span class="glyphicon {{ datagrid.sortDir === 'DESC' ? 'glyphicon-chevron-down': 'glyphicon-chevron-up' }}" ng-if="datagrid.isSorting(field)"></span>
{{ field.label() }}
</a>
<span ng-if="field.disableSort">
{{ field.label() }}
</span>
</th>
<th ng-if="datagrid.shouldDisplayActions" class="ng-admin-column-actions">
Actions
Expand Down

0 comments on commit 070f9d0

Please sign in to comment.