Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/modules/main/directives/mdtTableDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
tableCard: '=',
selectableRows: '=',
alternateHeaders: '=',
onInitTableCallback: '=',
deleteRowCallback: '&',
selectedRowCallback: '&',
saveRowCallback: '&',
Expand Down Expand Up @@ -221,6 +222,10 @@
_initEditCellFeature();
_initSelectableRowsFeature();

if ($scope.onInitTableCallback) {
$scope.onInitTableCallback(ctrl, $scope);
}

PaginationFeature.startFeature(ctrl);
ColumnSelectorFeature.initFeatureHeaderValues($scope.dataStorage.header, ctrl.columnSelectorFeature);

Expand Down
4 changes: 4 additions & 0 deletions app/modules/main/factories/mdtAjaxPaginationHelperFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
return this.totalResultCount;
};

mdtAjaxPaginationHelper.prototype.trackBy = function(item, $index) {
return item.rowId || $index;
};

mdtAjaxPaginationHelper.prototype.getRows = function(){
return this.dataStorage.storage;
};
Expand Down
11 changes: 8 additions & 3 deletions app/modules/main/factories/mdtPaginationHelperFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

function mdtPaginationHelperFactory(PaginatorTypeProvider, _){

function mdtPaginationHelper(dataStorage, paginationSetting){
function mdtPaginationHelper(dataStorage, paginationSetting, rowOptions){
this.paginatorType = PaginatorTypeProvider.ARRAY;
this.rowOptions = rowOptions;

this.dataStorage = dataStorage;

Expand Down Expand Up @@ -51,6 +52,10 @@
return this.dataStorage.storage.length;
};

mdtPaginationHelper.prototype.trackBy = function(item, $index) {
return item.rowId || $index;
};

mdtPaginationHelper.prototype.getRows = function(){
this.calculateVisibleRows();

Expand Down Expand Up @@ -85,8 +90,8 @@
};

return {
getInstance: function(dataStorage, isEnabled){
return new mdtPaginationHelper(dataStorage, isEnabled);
getInstance: function(dataStorage, isEnabled, rowOptions){
return new mdtPaginationHelper(dataStorage, isEnabled, rowOptions);
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion app/modules/main/templates/rows/generateRows.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<tr class="tbodyTrRow"
ng-repeat="rowData in mdtPaginationHelper.getRows() track by $index"
ng-repeat="rowData in mdtPaginationHelper.getRows() track by mdtPaginationHelper.trackBy(rowData, $index)"
ng-class="{'selectedRow': rowData.optionList.selected, '{{rowData.optionList.className}}': rowData.optionList.className }"
ng-show="(isPaginationEnabled() === false || rowData.optionList.visible === true) && rowData.optionList.deleted === false">

Expand Down
42 changes: 21 additions & 21 deletions dist/md-data-table-templates.js

Large diffs are not rendered by default.

Loading