Skip to Content
0

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

Mar 07, 2017 at 05:10 AM

456

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

8 Answers

Best Answer
avatar image
Former Member Mar 07, 2017 at 11:53 AM
0

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);

}

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Mar 07, 2017 at 05:54 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Mar 07, 2017 at 05:55 AM
0

Hi Prachi,

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

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Mar 07, 2017 at 06:30 AM
0

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?

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Mar 07, 2017 at 01:47 PM
0

we are using version 1.28

Share
10 |10000 characters needed characters left characters exceeded
Jun Wu Mar 07, 2017 at 03:19 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Mar 08, 2017 at 06:38 AM
0

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);

}

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Mar 09, 2017 at 01:06 AM
0

This is exactly what I am looking for!!

Thank you Vedaradhya. :)

Share
10 |10000 characters needed characters left characters exceeded