Skip to Content
avatar image
Former Member

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

8 Answers

  • Best Answer
    Mar 07, 2017 at 11:53 AM

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

    }

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 07, 2017 at 05:54 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 07, 2017 at 05:55 AM

    Hi Prachi,

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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 07, 2017 at 06:30 AM

    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?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 07, 2017 at 01:47 PM

    we are using version 1.28

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 07, 2017 at 03:19 PM

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

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 08, 2017 at 06:38 AM

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

    }

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 09, 2017 at 01:06 AM

    This is exactly what I am looking for!!

    Thank you Vedaradhya. :)

    Add comment
    10|10000 characters needed characters exceeded