0

I'm using flexmonster chart in my project, in the toolbar, I have a button with a custom menu. once the user is saving the data I want to add / delete items from that menu. in flexmonster documentation they say that I can change the toolbar by overriding the getTabs method:

let tabs = toolbar.getTabs(); 
  toolbar.getTabs = function () {
    // remove the Connect tab using its id
    tabs = tabs.filter(tab => tab.id != "fm-tab-connect");
    return tabs; 
  } 

however, that only works before the chart is rendered. is there a way to update the chart in real time after the chart is already rendered?

Joris Schellekens
  • 8,483
  • 2
  • 23
  • 54
richard nelson
  • 247
  • 4
  • 12

1 Answers1

0

You can use the updateToolbar method provided by Flexmonster.

const pivot = new Flexmonster({
  container: "pivot-container",
  toolbar: true,
});

function updateToolbar() {
  const tabs = pivot.toolbar.getTabs();
  // Modify the tabs array as needed, e.g., add or delete items

  // Remove the Connect tab using its id for instance
  const updatedTabs = tabs.filter((tab) => tab.id !== "fm-tab-connect");

  // Update the toolbar with the modified tabs
  pivot.toolbar.updateTabs(updatedTabs);
}

// Call the updateToolbar function whenever needed, e.g., after data is saved
updateToolbar();

Documentation 1 Documentation 2 Documentation 3

iamgoddey
  • 37
  • 1
  • 11