Files
Unify/application/elements/gridView/gridView.header.row.column.js
2025-12-25 11:16:59 +01:00

126 lines
1.5 KiB
JavaScript

import tableCell from "/elements/tableCell.js";
import sortBy from "./gridView.header.row.column.sortBy.js";
export default class gridViewRowColumn extends tableCell{
display = "table-cell";
layers = 1;
propegateEvent = false;
useCustomElement = false;
cursor = "pointer";
hoverBackgroundColor = "#363333"
async click() {
var renderCollection = this.parent.parent.parent.body;
renderCollection.sort = this.propertyName;
this.unselectOtherColumns();
var direction = this.selectThisColumn();
renderCollection.direction = direction;
renderCollection.update();
}
unselectOtherColumns() {
var columns = this.parent.getChildren();
for (var i = 0; i < columns.length; i++) {
var column = columns[i];
if( column.sortBy ) {
column.sortBy.text = "";
}
}
}
selectThisColumn() {
if( this.sortBy.type == "asc" ) {
this.sortBy.transform = "rotate(90deg)";
this.sortBy.type = "desc"
} else {
this.sortBy.transform = "rotate(-90deg)";
this.sortBy.type = "asc"
}
this.sortBy.text = "<";
return this.sortBy.type;
}
#ifdef WINDOWS
padding = 10;
paddingRight = 40;
paddingLeft = 20;
#ifdef DARK
paddingLeft = 30;
//borderLeft = "1px solid #24364e7a";
#endif
#ifdef LIGHT
#endif
#endif
#ifdef MACOS
padding = 10;
#ifdef DARK
#endif
#ifdef LIGHT
#endif
#endif
#ifdef ANDROID
padding = 20;
#endif
sortBy = new sortBy();
}