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 method getRows() returns only visible Rows #393
Comments
|
Hi Jennifer, you can currently use the getContextByIndex-method to get the row-context for all rows regardless of whether they are visible or not. https://sapui5.netweaver.ondemand.com/sdk/#docs/api/symbols/sap.ui.table.Table.html#getContextByIndex I will contact the control owner to get more information on this and get back to you. Internal reference: 1570147881 |
|
Hi Jennifer, When you only use client-models, you can go with getContextByIndex(). When you use OData models there are a few things to consider: If you require all data at the client, you might want to use the getContext method of the underlying (OData)ListBinding. It accepts start index, length and a threshold as parameters and will load the requested section from the backend or just return it if all is loaded. You need to register to the change event of the binding. This event will get fired when the model has finished loading. |
|
Hi, Can you please update the openui5 documentation https://openui5.hana.ondemand.com/#docs/api/symbols/sap.ui.table.Table.html#getRows ? Thank you guys. |
|
These methods are not working for me. I'm looking for a way to loop through the cell content for all of the cells. @SebastianRied @sirion |
|
Hello, If I need to know the selected indices (in collapse or expanded elements, both), it's not possible. getContextByIndex() need a parameter to return data. This solution not resolved the problem of the thread. Regards. |
|
So the table is for "big amount of data" but mass change does not work well? What would be the correct solution to mass change for example 2000 entries? A function import? How should it work with the information of ".getSelectedIndices()"? Frontend could be sorted somehow and also user could uncheck some entries. |
|
I found myself in the same situation. If I want to delete all entries in the table I need to set the table threshold to a number higher than the number of entries, in order to preload them beforehand and being able to get the context afterwards and calling remove for each entry path. This seems innapropiate to me, because I now have 2000 entries, but i could be having several thousands more... I thought about the idea of creating a function import for mass deletion, checking whether the select all is active or not, but what if the user selects all and afterwards deselects one? Is there gonna be any solution to this? Thank you |
|
I thin it is still open in SAP Ui5 16013... It says ... "Gets content of aggregation rows. Yeah well but only gets the visible rows. getSelectedIndices() returns all Indices but nothing else like the data/key of the row... Now im more or less blind on what rows the user has marked(selected) ,... My idea was to match the index with the rows to get the selected row var oTab = this.getView().byId("tblAdminMaint"); Do we have any other solution to read all currently selected rows(with data also not visible) ? Thanks in advance |
|
I now found a solution for me...
testItemsSelected: function (oEvent) { |
|
Hi TeeOlee, |
|
Still, I am finding some solutions for this. |
|
Hi, <smartTable:SmartTable id="LineItemsSmartTable" header="Smart Table" showRowCount="true" useVariantManagement="true" useTablePersonalisation="true" enableAutoBinding="true" entitySet="DATA" tableType="ResponsiveTable" initiallyVisibleFields="Column1,Column2,Column3" smartFilterId="smartFilterBar"> //START ##Just add code written between START and END to your table and use the same table Id= “TableId” to get your selected Column. |
|
For anyone comming across this problem I used this the get the actual number of rows visible, but this can also be used to read the rows. |
|
This looks a bit weird to me. The 2nd line is essentially the same as the event handler. What are you trying to achieve thereby? Maybe https://openui5.hana.ondemand.com/api/sap.ui.model.ListBinding#methods/getAllCurrentContexts is what you are looking for? |
The second line is to initialize, because |
|
Hi, Another quick workaround that might fit some use cases is to simply bind the visibleRowCount property of the table to the model that has the table data stored and calculate the length using expression binding. This way avoids any complicated JS code and handles the calculation directly in the XML view. visibleRowCount="{= ${tablemodel>/rows}.length }" In this example i have stored the data for the rows inside the rows property of my JSON Model "tablemodel". Now getRows() returns all the rows which can be useful at times. In my use case, i needed to apply custom css to specific table cells and this was the only way that worked. However, it might not be the best approach for a large dataset. |
|
I have a question leonikussmaul, how can I set the visible row count from the controller? Because initially I am displaying the TreeTable empty, and when the filters are populated, then with bindRows I am populating the table This is my code and is not working the parameter visibleRowCount Thanks a lot for the help, really appreciate it |
|
Hi @Vidal-Exxon-JM, Have you tried calling the method setVisibleRowCount()? Something like this in your controller..
|
In my use case I wanted to get the selected indices and the related rows. So I used the methods
getSelectedIndices()andgetRows(). But to my utter surprise I only get the actual visible rows, but the indices are the "real" indices (so when scrolled down they start fortunately NOT with 0).In my opinion this is a bug, because working with indices and the rows becomes useless. Also the method should be called "getVisibleRows()" or something similar to make it clear.
Actual I use "the workaround" that I use the indices with my related model.
OpenUI5 version:
1.24.2
Browser/version (+device/version):
Google Chrome 41.0.2272.118 (64-bit)
Any other tested browsers/devices(OK/FAIL):
Firefox 37.0.1
Steps to reproduce the problem:
http://jsbin.com/pujokiyusa/1/edit?html,console,output
What is the expected result?
getRows()should return ALL rowsWhat happens instead?
It returns only the displayed rows
The text was updated successfully, but these errors were encountered: