Our pure JavaScript Scheduler component


Post 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


Post by marcio »

Best regards,
Márcio


Post 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


Post 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();

Post by marcio »

Hey jbrazier,

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

Best regards,
Márcio


Post Reply