Skip to content

Commit

Permalink
not showing order on Search dialog unless "list" layout selected.
Browse files Browse the repository at this point in the history
  • Loading branch information
Clay-Ferguson committed Nov 24, 2024
1 parent f58a530 commit c00667e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/main/resources/public/src/dlg/SearchContentDlg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export class SearchContentDlg extends DialogBase {

renderDlg(): Comp[] {
const ast = getAs();
const state = this.getState<LS>();
let requirePriorityCheckbox = null;
if (this.getState<LS>().sortField === J.NodeProp.PRIORITY_FULL) {
requirePriorityCheckbox = new Checkbox("Require Priority", null, {
Expand Down Expand Up @@ -176,7 +177,8 @@ export class SearchContentDlg extends DialogBase {
},
getValue: (): string => this.getState<LS>().displayLayout
}),
new Selection(null, "Sort by", [
state.displayLayout == "list" ? new Selection(null, "Sort by", [
{ key: "none", val: "n/a" },
{ key: "mtm", val: "Modify Time" },
{ key: "ctm", val: "Create Time" },
{ key: "contentLength", val: "Text Length" },
Expand All @@ -201,7 +203,7 @@ export class SearchContentDlg extends DialogBase {
this.mergeState<LS>(newState);
},
getValue: (): string => this.getState<LS>().sortField
}),
}) : null,
new Div(null, null, [
requirePriorityCheckbox
])
Expand All @@ -217,6 +219,18 @@ export class SearchContentDlg extends DialogBase {
];
}

// We override so we can make adjustments
mergeState<T extends LS>(moreState: T): void {
const state: LS = this.getState<LS>();
if (state.displayLayout === "graph" || state.displayLayout === "doc") {
SearchContentDlg.dlgState.sortField = "";
SearchContentDlg.dlgState.sortDir = "none";
moreState.sortField = "";
moreState.sortDir = "none";
}
super.mergeState(moreState);
}

createSearchFieldIconButtons(): Comp {
return new ButtonBar([
new Button("Clear", () => {
Expand Down

0 comments on commit c00667e

Please sign in to comment.