getCurrentState();
The getCurrentState method returns the current state of the group of buttons used to switch between data view modes.
The method returns a JSON object that includes the following properties: grid, map, chart, bubbleChart. Each of these properties is an object and contains the properties visible and enabled, that set visibility and availability for the table, map, chart, or bubble chart respectively.
Executing the example requires that the HTML page contains the ExpressBox component named expressBox (see Example of Creating the ExpressBox Component). Use a script to learn which buttons are available:
// Get button group view for selecting data display mode var toolBar = expressBox.getDataView().getToolBarView(); // Get their current state var state = toolBar.getCurrentState(); console.log("Is bubbleChart is available: " + state.bubbleChart.enabled); console.log("Is chart is available: " + state.chart.enabled); console.log("Is grid is available: " + state.grid.enabled); console.log("Is map is available: " + state.map.enabled);
After executing the example the browser console displays the data on buttons availability, and the user can seeat the Map button is unavailable:
Is bubbleChart is available: true
Is chart is available: true
Is grid is available: true
Is map is available: false
See also: