| 105 | } |
| 106 | |
| 107 | private setSort( |
| 108 | sortConfig: GenericSortConfig | boolean, |
| 109 | columns?: OneDArray<TColumn>, |
| 110 | ): void { |
| 111 | const cols = columns || this.columns || []; |
| 112 | |
| 113 | for (const column of cols) { |
| 114 | // sorting can only be enabled for columns without any children |
| 115 | if (column.columns && column.columns.length > 0) { |
| 116 | column.sort = undefined; |
| 117 | } else if (column.sort === undefined && sortConfig) { |
| 118 | column.sort = {}; |
| 119 | } else if (!column.sort) { |
| 120 | // false, null, etc. |
| 121 | column.sort = undefined; |
| 122 | } else if (typeof column.sort === 'object') { |
| 123 | column.sort = { |
| 124 | ...column.sort, |
| 125 | }; |
| 126 | } |
| 127 | |
| 128 | if (column.columns) { |
| 129 | this.setSort(sortConfig, column.columns); |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | private setResizable(resizable: boolean, columns?: OneDArray<TColumn>): void { |
| 135 | const cols = columns || this.columns || []; |