-
Notifications
You must be signed in to change notification settings - Fork 4
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
Table: calculating virtualRowHeight when the rows have a different height #173
Comments
Current status? |
??? |
This Ticket is open since 2021 and I've never encountered an issue that would need this. So it is not needed |
I guess it wasn't used because it didn't work or it just works? Did you test this feature wit current implementation? |
I will test it. |
@mhandsteiner created a project for me with enough rows to enable virtualScrolling, then I've changed a field of a row to contain HTML text so that the row height would be different for these rows. I did that for every 5-10 rows until row 300. 2024-02-28.13-48-10.mp4video added just in case |
the toolbar looks wrong in your screenshot? |
@rjahn is there an example project for this? As far as I can tell, Primereact works with a single item height in their virtual scroller logic so having differently sized row heights might produce some awkward results |
I implemented a proof of concept that will look at the initial 100 rows and will cet the row height based on the maximum height. This seems to be the behavior in the java client @rjahn please correct me if I am wrong in this assumption. |
In swing it isn't possible to have different row heights. In react it should be. This ticket shouldn't implement same height for all rows in react. I guess there was a problem with different row heights, but it shouldn't be with current primereact versions? If different row heights are possible and don't cause problems with react, we should allow it. Your PoC is a cool implementation and we should keep it, but not enabled by default. You could check a new table property like: sameRowHeight (boolean). Do you already support rowHeight, maxRowHeight, minRowHeight in your calculation? because there are properties in WebTable. If rowHeight is set -> fixed height but also check min and max So, if sameRowHeight is set -> calculate and if one of rowHeight, minRowHeight, maxRowHeight is set -> should work as well |
I put the behavior behind and option as discussed. Regarding rowHeight, minRowHeight and maxRowHeight - I don't think those are supported yet. The only way I can see how row heights are set right now is via the css theme. Are those props already set and sent in any of the feature screens? |
Sorry, no usage right now in demo application. But it's easy to test. User: features UITable table = new UITable();
table.setDataBook(rdbContacts);
// test code
table.setMinRowHeight(5); search table.setDataBook(rdbContact); and insert your test code below. Restart application server. |
I made a test with row height and dynamic row height without setting sameRowHeight, looks good. One problem: Server sends
and client renders:
If you want to test, simply svn update demo project and change SimpleContactsWorkScreen -> replace:
Not sure if this is our problem or a browser problem? |
I made tests with sameRowHeight and had a problem with row selection! Test with features and Simple Contacts Screen. Enable same row height - code is in comment: /* Open the screen and press New (random) button multiple times. Sometimes, it's not possible to select another record by clicking on a different row. |
the table should support |
Did you fix row selection problem as well? |
I wasn't able to reproduce that yet but I am still looking into it. I had to refactor the cell rendering a bit for the height measuring which caused some of the other table cell issues recently so It is very likely an issue of components not being recycled correctly. |
Did some tests: setRowHeight is always ignored. I should explain it better: default (sameRowHeight not set): setRowHeight (rowHeight): if set, the rows should use this height (take care of min, max) sameRowHeight: also take care of rowHeight (if set) and ignore the calculated row Height (better: don't calculate). Also check min and max if set. no custom rowHeight set, but sameRowHeight: calculate row height and take care of min/max (if set) |
|
@rjahn regarding the rows not being selectable It looks like selection requests are sent e.g. like this after creating multiple new rows and selecting the third row : {
"clientId": "SIx-a49db1f2-13c1-47a0-a39d-210d65c2f5fd",
"componentId": "SimCon-QQ_T_contacts",
"dataProvider": "JVxMobileDemo/SimCon-QQ/contacts#4",
"filter": {
"columnNames": [
"ID"
],
"values": [
null
]
},
"selectedColumn": "SALU_SALUTATION",
"rowNumber": 2
} but the response is just an empty array |
fixed row selection - was a server bug. I will check rowHeight asap. |
@rjahn in your example you also set a height via |
Hm.. not good, because if a developer sets a fixed row height, it should be exactly as set. |
Ok I reverted that change again |
It should be possible that some rows have a different height than usual (when a row includes html, images or possibly more cases I can't think of right now).
When that is the case, we should probably take the div tag where all rows are located and calculate the average row height to use as virtualRowheight.
This could be a problem (performance) when the column-size changes and we need to re-adjust the virtualRowHeight.
This clearly needs some discussion
The text was updated successfully, but these errors were encountered: