Skip to content

Commit 6016aa3

Browse files
committed
GridController transform fix + test
1 parent 7c680be commit 6016aa3

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

src/ui-scroll-grid.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -220,26 +220,15 @@ angular.module('ui.scroll.grid', [])
220220

221221
function transform (row) {
222222
let parent = row[0].parent();
223-
let last = row[row.length-1].next();
224223
let visible = [];
225224

226225
row.forEach((cell, index) => {
227226
columns[index].applyCss(cell);
228227
visible[columns[index].mapTo] = row[index];
228+
row[index].detach();
229229
});
230230

231-
let current = visible.shift();
232-
current.detach();
233-
if (last.length)
234-
last.before(current);
235-
else
236-
parent.append(current);
237-
238-
visible.forEach((cell) => {
239-
cell.detach();
240-
current.after(cell);
241-
current = cell;
242-
});
231+
visible.forEach(cell => parent.append(cell));
243232
}
244233

245234
}

test/GridTestsSpec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,8 @@ describe('uiScroll', function () {
391391
applyOrderLayout(scope, [1, 3, 2, 0]);
392392
expectLastRowContents(body, ['col3', 'col0', 'col2', 'col1']);
393393

394-
applyOrderLayout(scope, [0, 2, 3, 1]); // this is broken !!
395-
//expectLastRowContents(body, ['col0', 'col3', 'col1', 'col2']);
394+
applyOrderLayout(scope, [0, 2, 3, 1]);
395+
expectLastRowContents(body, ['col0', 'col3', 'col1', 'col2']);
396396
}
397397
);
398398
});

0 commit comments

Comments
 (0)