Skip to content

Commit

Permalink
browser: treeview: add event listener 'click' expander
Browse files Browse the repository at this point in the history
Change-Id: I00b2b3eb00c46532b69f28fcc0c3a16b2383f688
Signed-off-by: Henry Castro <[email protected]>
  • Loading branch information
hcvcastro committed Jul 17, 2024
1 parent 402ff42 commit 45008cf
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions browser/src/control/jsdialog/Widget.TreeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,21 @@ class TreeViewControl {
this._tableContainer._tbody = L.DomUtil.create('tbody', builder.options.cssClass +
' ui-treeview-body', this._tableContainer);
this._tableContainer.setAttribute('role', 'grid');
this._tableContainer.addEventListener('click', L.bind(TreeViewControl.onClick));
}

static onClick(e) {
let td = e.target;
if (!td || td.localName !== 'td')
return;

let row = td.parentElement;
if (!row || row.localName !== 'tr' || !row.hasAttribute('aria-expanded'))
return;

let expand = td.firstChild;
if (expand && e.clientX < expand.getBoundingClientRect().left)
console.log('click expand ');
}

fillHeaders(headers, builder) {
Expand Down

0 comments on commit 45008cf

Please sign in to comment.