aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/SchemaHeaderField.ts
diff options
context:
space:
mode:
authorfawn <fangrui_tong@brown.edu>2019-07-30 16:21:54 -0400
committerfawn <fangrui_tong@brown.edu>2019-07-30 16:21:54 -0400
commit78999b8b35267db9236bbb69e7e90e8691c59ba9 (patch)
treeeba2e58999ea22e9324c2c652812552a1d96190b /src/new_fields/SchemaHeaderField.ts
parentdd5d7503e05962fa9a22baa9f5fa00373393ac11 (diff)
sorting saves on schema columns
Diffstat (limited to 'src/new_fields/SchemaHeaderField.ts')
-rw-r--r--src/new_fields/SchemaHeaderField.ts22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/new_fields/SchemaHeaderField.ts b/src/new_fields/SchemaHeaderField.ts
index bccf82a9e..0c19d211a 100644
--- a/src/new_fields/SchemaHeaderField.ts
+++ b/src/new_fields/SchemaHeaderField.ts
@@ -51,19 +51,17 @@ export class SchemaHeaderField extends ObjectField {
type: number;
@serializable(primitive())
width: number;
+ @serializable(primitive())
+ desc: boolean | undefined; // boolean determines sort order, undefined when no sort
- constructor(heading: string = "", color: string = RandomPastel(), type?: ColumnType, width?: number) {
+ constructor(heading: string = "", color: string = RandomPastel(), type?: ColumnType, width?: number, desc?: boolean) {
super();
this.heading = heading;
this.color = color;
- if (type) {
- this.type = type;
- }
- else {
- this.type = 0;
- }
+ this.type = type ? type : 0;
this.width = width ? width : -1;
+ this.desc = desc;
}
setHeading(heading: string) {
@@ -81,6 +79,16 @@ export class SchemaHeaderField extends ObjectField {
this[OnUpdate]();
}
+ setWidth(width: number) {
+ this.width = width;
+ this[OnUpdate]();
+ }
+
+ setDesc(desc: boolean | undefined) {
+ this.desc = desc;
+ this[OnUpdate]();
+ }
+
[Copy]() {
return new SchemaHeaderField(this.heading, this.color, this.type);
}