mui-toolpad icon indicating copy to clipboard operation
mui-toolpad copied to clipboard

Unable to navigate to another Toolpad page from datagrid

Open prakhargupta1 opened this issue 9 months ago • 1 comments

Summary

I have a data grid with a list of orders. From the order ID field, I want to open the order details page. I thought of two ways to do this, but none worked.

Option 1

By converting the OrderID field to a link component. But then the Link field is not customizable as mentioned in https://github.com/mui/mui-toolpad/issues/2568 and https://github.com/mui/mui-toolpad/issues/1561

Option 2

Since my use case is to navigate to another page within the Toolpad app, I thought of using the Button component as it has the onClick navigation action. However, it was not available inside the data grid. So, I created a custom button component. Now, this button works fine when outside of Datagrid, but it fails to work when I use it inside the data grid. Video below:

https://github.com/mui/mui-toolpad/assets/92228082/c99184fb-4224-4952-925c-0b4c2be01b4a

Search keywords: navigate

prakhargupta1 avatar May 01 '24 11:05 prakhargupta1

I think the solution will be to expand the link column type:

  • Make it possible to dynamically map the row to a link href
  • Make it possible to dynamically map the row to an alias

In that sense, I'd consider this issue and https://github.com/mui/mui-toolpad/issues/1561 as duplicates.

In the meantime, a good solution will be to work with selected row + external button, as you did in your video

Janpot avatar May 02 '24 08:05 Janpot

I think the solution will be to expand the link column type:

Yes, that makes sense. I'll close this issue and prioritize extending the link column type. I think it would be a good addition to data grid capabilities inside Toolpad.

prakhargupta1 avatar May 07 '24 10:05 prakhargupta1