Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: sort and page events are not working with Table chart #695

Open
1 task
Sagar-AArya opened this issue Dec 9, 2022 · 1 comment
Open
1 task

[Bug]: sort and page events are not working with Table chart #695

Sagar-AArya opened this issue Dec 9, 2022 · 1 comment
Labels

Comments

@Sagar-AArya
Copy link

Sagar-AArya commented Dec 9, 2022

Would you like to work on a fix?

  • Check this if you would like to implement a PR, we are more than happy to help you go through the process.

Current and expected behavior

I'm trying to handle 2 events.

  1. sort event when a column header is clicked and
  2. page event when the page navigation button is clicked.

The events are supposed to fire when the action happens. but they are not working as expected.

Reproduction

https://codesandbox.io/s/reverent-panini-3ntox9?file=/App.tsx

react-google-charts version

v4.0.0

Possible solution

No response

@Sagar-AArya Sagar-AArya added the bug label Dec 9, 2022
@mangege
Copy link

mangege commented Sep 22, 2023

However, ChartWrapper currently only propagates a subset of events thrown by charts: select, ready, and error. Other events are not transmitted through the ChartWrapper instance; to get other events, you must call getChart() and subscribe to events directly on the chart handle, as shown here:

ref: https://developers.google.com/chart/interactive/docs/reference#chartwrapperobject

  {
    eventName: "ready",
    callback: ({ chartWrapper, google }) => {
      console.log("ready event");
      const chart = chartWrapper.getChart();
      google.visualization.events.addListener(chart, 'page', (params) => {
        console.log("params", params);
      });
      google.visualization.events.addListener(chart, 'sort', (params) => {
        console.log("params", params);
      });
    }
  }

Example: https://codesandbox.io/s/rough-https-5lj492

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants