Permalink
Browse files

fix(sorting): disable sorting for collections

  • Loading branch information...
VMBindraban
VMBindraban committed Jul 27, 2016
1 parent 80912bf commit a2a890d8e192b78293983bceab6fc6f07c8f02f7
Showing with 16 additions and 4 deletions.
  1. +16 −4 src/datatable.js
@@ -122,12 +122,12 @@ export class DataTable {
}
doSort(columnLabel) {
if (this.sortable === null || columnLabel.column.indexOf('.') !== -1) {
let column = columnLabel.column;
if (this.sortable === null || !this.isSortable(column)) {
return;
}
let column = columnLabel.column;
this.criteria.sort = {
[column]: this.criteria.sort[column] === 'asc' ? 'desc' : 'asc'
};
@@ -201,7 +201,7 @@ export class DataTable {
}
labels.push({
nested : cleanedColumn.indexOf('.') !== -1,
nested : !this.isSortable(cleanedColumn),
column : cleanedColumn,
label : ucfirst(clean(aliased[1] || aliased[0])),
converter: (converter.length > 1) ? converter.slice(1).join(' | ') : false
@@ -227,6 +227,18 @@ export class DataTable {
}
}
isSortable(column) {
if (column.indexOf('.') > 0) {
return false;
}
if (!this.populate) {
return true;
}
return this.populate.replace(' ', '').split(',').indexOf(column) === -1;
}
displayValue(row, ...propertyName) {
return fetchFrom(row, ...normalizeKey(...propertyName));
}

0 comments on commit a2a890d

Please sign in to comment.