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

Server-side search no longer calls to search function #1411

Closed
SaturnR opened this issue Jan 15, 2024 · 2 comments · Fixed by #1412
Closed

Server-side search no longer calls to search function #1411

SaturnR opened this issue Jan 15, 2024 · 2 comments · Fixed by #1412
Labels
bug fix Something isn't working

Comments

@SaturnR
Copy link

SaturnR commented Jan 15, 2024

The search feature stopped working in the new 6.1.0 release. The old 6.0.6 version works well.

In my case, the function searchURL is never executed.

  function searchURL(prev, keyword){
    console.log(prev, keyword);
    return `${prev}${prev.includes("?")? "&": "?"}search=${keyword}`;
  }

  React.useEffect(() => {
    if (grid == null) {
      const data = null;

      var table_grid = new gridjs.Grid({
            columns: columns,
            sort: false,
            pagination: true,
            fixedHeader: true,
            search: true,
            resizable: true,
            data: data,
            search: {
              server: {
                url: (prev, keyword) => searchURL(prev, keyword)
              }
            },
            server: {
              url: url,
              then: (data) =>
                unpackData(data)
              ,
              total: (data) => data.count,
            },
            pagination: {
              limit: 10,
              server: {
                url: (prev, page, limit) =>
                  `${prev}${prev.includes("?")? "&": "?"}limit=${limit}&offset=${page * limit}`,
              },
            },
          });
        setGrid(table_grid);
        table_grid.render(wrapperRef.current);
    }else{
      grid.render(wrapperRef.current);
    }
  });
  return (<div ref={wrapperRef} />);
};

No additional errors or warnings from grid.js

@vkresch
Copy link

vkresch commented Jan 15, 2024

I noticed the same issue only in version 6.1.0 which was released yesterday (#1408). cc @afshinm

@afshinm afshinm added the bug fix Something isn't working label Jan 15, 2024
@afshinm
Copy link
Member

afshinm commented Jan 15, 2024

@vkresch @SaturnR This is fixed now, please try https://github.com/grid-js/gridjs/releases/tag/6.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants