-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: set columns order correctly with more than 10 columns (#2297)
- Loading branch information
Showing
4 changed files
with
89 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
|
||
/** | ||
* @param {Array<Object>} columns array of columns to be modified | ||
* @param {number} scope multiplier added to base order for each column | ||
* @param {number} baseOrder base number used for order | ||
*/ | ||
export function updateColumnOrders(columns, scope, baseOrder) { | ||
let c = 1; | ||
columns.forEach((column) => { | ||
// avoid multiples of 10 because they introduce and extra zero and | ||
// causes the underlying calculations for child order goes wrong | ||
if (c % 10 === 0) { | ||
c++; | ||
} | ||
column._order = baseOrder + c * scope; | ||
c++; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters