Page 1 of 1

[VUE 3] Focused cell

Posted: Fri May 26, 2023 4:33 pm
by jbrazier

Hi,

I'm trying to find a way to set a column cell so that it is not focused when I click outside the scheduler.

Whenever you select a resource column cell it is populated with the b-focused class e.g.

class="b-grid-cell b-resourceinfo-cell swimlane-cell b-focused"

But I can't find a simple way to unfocus that particular cell - calling the deselect methods don't seem to do anything.

Currently I have a workaround to remove the b-focused class
e.g.

const focusedCell = document.querySelector(
    '.b-resourceinfo-cell.b-focused'
  );
  if (focusedCell) {
    focusedCell.classList.remove('b-focused');
  }

But this doesn't feel like the right way to do it?

Thanks,

Jason


Re: [VUE 3] Focused cell

Posted: Fri May 26, 2023 4:41 pm
by marcio

Re: [VUE 3] Focused cell

Posted: Fri May 26, 2023 5:05 pm
by jbrazier

Hi Marcio,

I had seen that function but not actually tried it - when I call it it doesn't seem to remove the focus from the selected cell unfortunately.

Thanks,

Jason


Re: [VUE 3] Focused cell

Posted: Fri May 26, 2023 5:49 pm
by jbrazier

I have managed to resolve it by setting focus on the time axis cell instead - not sure it's the best approach but it does work

    // Set focus on the time-axis cell instead
    const cellElement = document.querySelector(
      '.b-timeaxis-cell'
    ) as HTMLElement;
    cellElement.click();
    cellElement.focus();

Re: [VUE 3] Focused cell

Posted: Fri May 26, 2023 6:35 pm
by marcio

Hey jbrazier,

That approach will work, focusing on another element will solve the issue.