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

Events not working #1349

Open
somegooser opened this issue May 1, 2023 · 13 comments
Open

Events not working #1349

somegooser opened this issue May 1, 2023 · 13 comments

Comments

@somegooser
Copy link

Events like ready and load are not getting triggered. It was working in the previous release version. Version 5.

@dor-squadded
Copy link

Came across it just now, since I need to know when the table was rendered.
Hope the owners will fix it soon

@stale
Copy link

stale bot commented Aug 10, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added wontfix This will not be worked on and removed wontfix This will not be worked on labels Aug 10, 2023
@somegooser
Copy link
Author

Unfortunately im still using version 5 because of this.

@scarchik
Copy link

scarchik commented Aug 29, 2023

Looked through code and it appears emitting event like "ready" was removed. Maybe is had been done intentionally because they have states that can be tracked. Who knows?

I use a workaround over states for now.

Example:

const grid = new gridjs.Grid(...)

function tableStatesListener(state, prevState) {
    if (prevState.status < state.status) {
        if (prevState.status === 2 && state.status === 3) {
            console.log('Ready');
        }
    }
}

grid.config.store.subscribe(tableStatesListener);
grid.render(document.getElementById("table"));

@carry0987
Copy link

Looked through code and it appears emitting event like "ready" was removed. Maybe is had been done intentionally because they have states that can be tracked. Who knows?

I use a workaround over states for now.

Example:

const grid = new gridjs.Grid(...)
//...

Thank you very much! However, I'm still curious as to why those events were removed. If we need to render something right after the grid has been rendered, it seems that there's no way to add an event listener for this scenario.

@phillip-haydon
Copy link

Hmmm is this project dead?

@bastiedotorg
Copy link

hi, my latest PR fixes the ready event at least. #1466

@carry0987
Copy link

hi, my latest PR fixes the ready event at least. #1466

Thanks a lot ! Hope they can merge it quickly.

@charlesmudy
Copy link

charlesmudy commented Oct 15, 2024

@bastiedotorg I'm unable to trace it with the install from https://www.npmjs.com/package/gridjs ... can you help? The ready isn't working for 6.2.0

Any thought @afshinm ?

@scarchik your solution works but seem to set on a max of the pagination (10). From my previous version 5.1.0 ... I was able to do the following to download a CSV file

grid.updateConfig({ pagination: { enabled: false } }).forceRender(); grid.on('ready', () => {

Then reset the grid back to pagination

@bastiedotorg
Copy link

@charlesmudy I am unsure what our question is. can you elaborate?

@charlesmudy
Copy link

charlesmudy commented Oct 15, 2024

@bastiedotorg I'm on version 6.2.0 and unable to use the ready event. You referenced a PR hack which hasn't been merged yet.

Wondering how I can do it locally/manually ?

@bastiedotorg
Copy link

ah, basically you need to change the file mentioned here https://github.com/grid-js/gridjs/pull/1466/files
and recompile the package

@charlesmudy
Copy link

You are the best ...Thank you! @bastiedotorg
ready works now

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

No branches or pull requests

7 participants