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

SimpleFormIterator - allow to customize Row Number display #4525

Closed
bohdan-shulha opened this issue Mar 13, 2020 · 5 comments
Closed

SimpleFormIterator - allow to customize Row Number display #4525

bohdan-shulha opened this issue Mar 13, 2020 · 5 comments

Comments

@bohdan-shulha
Copy link

bohdan-shulha commented Mar 13, 2020

Hi RA Community!

I have a feature request (which I am ready to contribute) - add SimpleFormIterator some flexibility by allowing to customize the component which is used to display the row number.

My tiny project requires me to support internationalization for my entities and I would like to remove the row index (A) or replace it with the language name or code (B).

That is how it may look today:
https://user-images.githubusercontent.com/533048/76638765-aac6c400-6555-11ea-9eab-35c38b48c03c.png

This is what I want to get:
(A) - this is current behavior for smaller screens
https://user-images.githubusercontent.com/533048/76639526-f62da200-6556-11ea-9890-92cc2079d88d.png

(B) - currently not possible
https://user-images.githubusercontent.com/533048/76639178-596b0480-6556-11ea-9a1c-409cc976f3ae.png

Specification
The extended SimpleFormIterator may have the next interface:

<SimpleFormIterator RowNumber={CustomRowNumberComponent} />
// or
<SimpleFormIterator RowNumber={<CustomRowNumberComponent />} />
// or both by detecting whether the RowNumber is a function or a React Node

It will then expect the RowNumber component to accept the record prop (as for me, it is better, but a bit complex and currently not obvious how to do) or just the index as it "does" today.

Extra
If I am authorized to do the change, should the component be converted to TypeScript?

@fzaninotto
Copy link
Member

That's a great idea, and yes for the TypeScript conversion.

But how do you see this new feature work when a user adds a new element in the array?

@bohdan-shulha
Copy link
Author

bohdan-shulha commented Mar 15, 2020

But how do you see this new feature work when a user adds a new element in the array?

If a user chooses to replace the default RowNumber component it is one's responsibility to correctly show the value (either it be an index, which should be passed to RowNumber component or a custom label).

I'll try to deliver the change by an EOW.

@jdemangeon
Copy link
Contributor

Hello @bohdan-shulha, do you have some time to spent on the associated PR ? In other case, we'll consider clsing it and mark the issue as "goodfirstissue".

@WiXSL
Copy link
Contributor

WiXSL commented Jan 28, 2022

Implemented in #6305

@WiXSL WiXSL closed this as completed Jan 28, 2022
@bohdan-shulha
Copy link
Author

Ugh, the EOW took me away for... Two years? I'm sorry, guys :(

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

No branches or pull requests

4 participants