DoriBro
Posts: 18
Joined: Tue Mar 23, 2021 8:42 pm

React: allButtonsEnabled Doesn't Change Class Names When I Press Buttons That Were Previously Disabled

This is the link to the fiddle provided in the allButtonsEnabled docs. https://jsfiddle.net/gh/get/library/pur ... bled-true/

If you set allButtonsEnabled equal to false, you can see that 1y should originally be disabled. This is because there is not enough data to fill that range entirely. Obviously setting allButtonsEnabled equal to true allows us the click that 1y button. It functions as expected, but the UI does not.

I expect the 1y button to get the same "selected" styling as the other buttons when they are clicked on. You can see that when you click on the other buttons, they get this blue-ish background and bold text, but clicking on the 1y button does not have any styling changes.

How can I get this "pressed" styling on previously disabled buttons? I am using React by the way.

My observations:
- When testing the rangeSelector in the browser, the other buttons (ones that are enabled regardless of the allButtonsEnabled property) get the highcharts-button-pressed class name when clicked
- The buttons that were previously disabled buttons (buttons that are disabled unless allButtonsEnable property is true) do not get this class name change and are stuck with the highcharts-button-normal class name, regardless if clicked.

Another way I can ask my question is how do I get this class name change to work on buttons that we previously disabled?
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: React: allButtonsEnabled Doesn't Change Class Names When I Press Buttons That Were Previously Disabled

Hello DoriBro!

Welcome to our forum and thanks for contacting us with your question!

The data in this demo doesn't cover the whole year. When you add the one day that's missing it works fine:

Code: Select all

data.push([1514768400000, -2, 1]);

As far as I know, we've already got a ticket about that on our GitHub and someone should take care of it soon.
So if adding a new point doesn't meet your expectation I suggest waiting for a fix.

Best regards!
Dominik Chudy
Highcharts Developer
DoriBro
Posts: 18
Joined: Tue Mar 23, 2021 8:42 pm

Re: React: allButtonsEnabled Doesn't Change Class Names When I Press Buttons That Were Previously Disabled

Hi Dominik.c,

Thanks for the help, warm welcome, quick reply, and mentioning that there is a fix coming.

For my app I need the button styling to change even if the data doesn't cover the whole time range, so I will just wait for the fix like you suggested!

Best regards,
Dorian
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: React: allButtonsEnabled Doesn't Change Class Names When I Press Buttons That Were Previously Disabled

Hi again!

Great, I'll keep you informed. :)

Best regards!
Dominik Chudy
Highcharts Developer

Return to “Highcharts Stock”