Skip to content

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

Closed
@SaturnR

Description

@SaturnR

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug fixSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions