cancel
Showing results for 
Search instead for 
Did you mean: 

In sap.ui.table.table how to get the data till last scroll ?

Former Member
0 Kudos

In sap.ui.table.table, get rows count till last scroll.

Accepted Solutions (1)

Accepted Solutions (1)

vedaradhya
Participant
0 Kudos

Hi Prachi,

If your SAPUI5 version is higher than the 1.37. SAP has provided one event(firstVisibleRowChanged) for getting firstVisibleRow count. this event fires on Scrolling table. for more details go through API UI Table Event

Just try by modified below code:

XML:

<table:Table id="tableId"

threshold="100"

selectionMode="MultiToggle"

enableBusyIndicator="false"

visibleRowCount="10"

fixedColumnCount="2"

rowHeight="39"

showNoData="true"

firstVisibleRowChanged="onScroll"

>

Controller:

onScroll : function() {

var iCount = this.getView().byId("tableId").getVisibleRowCount() + oEvent.getParameter("firstVisibleRow");

alert(iCount);

}

Answers (7)

Answers (7)

Former Member
0 Kudos

This is exactly what I am looking for!!

Thank you Vedaradhya. 🙂

vedaradhya
Participant
0 Kudos

If your sapui5 version is 1.28, then try by modifying controller code. shown below

XML:

<table:Table id="tableId"

threshold="100"

selectionMode="MultiToggle"

enableBusyIndicator="false"

visibleRowCount="10"

fixedColumnCount="2"

rowHeight="39"

showNoData="true">

Controller:

onButtonPress: function() {

var oTable = this.getView().byId("tableId");

var selectedRow = oTable.getVisibleRowCount() + oTable.getFirstVisibleRow();

alert(selectedRow);

}

junwu
Active Contributor
0 Kudos

all your data is in the model. what u want to do? you can also count the row there.

Former Member
0 Kudos

we are using version 1.28

Former Member
0 Kudos

Hi Vijay,

No issue with scrollbar or data.

In my Table, visibleRowCount is 10.

If I scroll down till 50 records then the loaded data (records) is 50; however the rows visible to end user are 10 only as mentioned above.

So my requirement is on Button press I want the data as 50; or 30 or whatever the number of records that are loaded on scroll.

Using the below does not fulfill my objective.

var selectedRow = oTable.getVisibleRowCount().length;

I get 10 records and not 50.

Any suggestions?

Former Member
0 Kudos

Hi Prachi,

Not clear in your question, can you please elobrate, whether you want scroll bar or full data in the table????

Former Member
0 Kudos

below is the code:

XML:

<table:Table id="tableId"

threshold="100"

selectionMode="MultiToggle"

enableBusyIndicator="false"

visibleRowCount="10"

fixedColumnCount="2"

rowHeight="39"

showNoData="true">

Controller:

onButtonPress: function() {

var oTable = this.getView().byId("tableId");

var selectedRow = oTable.getVisibleRowCount();

alert(selectedRow);

}

After scroll selectedRow is "10". But my requirement is till scroll I want row count should be dynamic.

For example if I scroll till 30 rows I should be able to get the row count as 30. Please let me know if you have any idea on how to achieve this.