Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

domLayout does not update dymanically #50

Open
shauncullen opened this issue Dec 14, 2020 · 1 comment
Open

domLayout does not update dymanically #50

shauncullen opened this issue Dec 14, 2020 · 1 comment

Comments

@shauncullen
Copy link

When changing the domLayout either via the prop or the api method setDomLayout, the divs enclosing the data do not update dynamically when the change is made, only when the grid is first rendered on the page.

@denisgursky
Copy link

As mentioned above, this doesn't work

function TestCmp({ domLayout }) {
  return (
    <AgGridReact
      // other props here
      domLayout={domLayout}
    />
  );
}

setDomLayout doesn't works either

function TestCmp({ domLayout }) {
  const [gridApi, setGridApi] = useState<GridApi>();

  const onGridReady = useCallback(params => {
    setGridApi(params.api);
  }, []);

  useEffect(() => {
    if (gridApi) {
      gridApi.setDomLayout(domLayout);
    }
  }, [domLayout, gridApi]);

  return (
    <AgGridReact
      // other props
      domLayout={domLayout}
    />
  );
}

But setDomLayout does work if you always set the layout to normal or don't pass it at all.

function TestCmp({ domLayout }) {
  const [gridApi, setGridApi] = useState<GridApi>();

  const onGridReady = useCallback(params => {
    setGridApi(params.api);
  }, []);

  useEffect(() => {
    if (gridApi) {
      gridApi.setDomLayout(domLayout);
    }
  }, [domLayout, gridApi]);

  return (
    <AgGridReact
      // other props
      domLayout='normal'
    />
  );
}

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

No branches or pull requests

2 participants