Skip to content

Commit

Permalink
[ADD] allow to hide optional columns on cmis table + better handling …
Browse files Browse the repository at this point in the history
…to avoid page refresh if optional columns is displayed
  • Loading branch information
benwillig committed May 30, 2024
1 parent ed6d2bd commit 5d0dc8b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-name="cmis_web.CmisDocumentLinkExisting" owl="1">
<Dialog size="'md'" title="props.title">
<Dialog size="'xl'" title="props.title">
<form class="form-horizontal cmis-link-document-existing" role="form">
<div class="row" name="identifierInput">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export class CmisDocumentSearch extends CmisSessionComponent {
list: this.state.cmisObjectsWrap,
displayActions: false,
onClickRow: this.onClickRow.bind(this),
hideOptionalColumns: true,
};
return props;
}
Expand Down
11 changes: 11 additions & 0 deletions cmis_web/static/src/cmis_table/cmis_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const {Component, useState} = owl;
export class CmisTable extends Component {
setup() {
this.displayActions = this.props.displayActions;
this.hideOptionalColumns = this.props.hideOptionalColumns;
if (this.displayActions === undefined) {
this.displayActions = true;
}
Expand Down Expand Up @@ -207,6 +208,12 @@ export class CmisTable extends Component {
return ["deleteObject", "renameObject", "updateDocumentContent"];
}

onClickToggler(ev) {
// clicking on the optional columns button perform a page refresh
// when the cmis table is displayed inside a modal
ev.preventDefault();
}

get dynamicActionsProps() {
const props = {
dynamicActions: {},
Expand Down Expand Up @@ -312,5 +319,9 @@ export const cmisTableProps = {
type: Function,
optional: true,
},
hideOptionalColumns: {
type: Boolean,
optional: true,
}
};
CmisTable.props = cmisTableProps;
4 changes: 3 additions & 1 deletion cmis_web/static/src/cmis_table/cmis_table.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@
class="'o_optional_columns_dropdown text-center border-top-0'"
togglerClass="'btn p-0'"
skipTogglerTabbing="true"
t-props="cmisTableDropdownDynamicProps"
position="'bottom-end'"
t-props="cmisTableDropdownDynamicProps"
t-if="!hideOptionalColumns"
>
<t t-set-slot="toggler">
<i
class="o_optional_columns_dropdown_toggle oi oi-fw oi-settings-adjust"
t-on-click="onClickToggler"
/>
</t>

Expand Down

0 comments on commit 5d0dc8b

Please sign in to comment.