Skip to Content
avatar image
Former Member

Dynamic scrolling in tables

Hi,

I want to implement a logic where in i have to scroll table dynamically as soon as a 6th row is added to a table of 5 visible rows.

Can somebody help me in this regard.

Regards,

Soumya

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Oct 09, 2009 at 09:35 AM

    Hi,

    U can set the value of firstActualRow and firstVisibleRow for this.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 09, 2009 at 09:41 AM

    hi,

    This code will set only 5 visible rows .

    Bind the visiblerow count property of table with an attribute of type I.

    Before binding the table with internal table write this code :

    DESCRIBE TABLE t_selected_hcp LINES lv_visiblerow.

    • ****** Reduce the no of visible rows *************

    IF lv_visiblerow > 5.

    lv_visiblerow = 5 .

    ENDIF.

    • * navigate from <CONTEXT> to <CN_TABLEPROP> via lead selection

    lo_nd_cn_tableprop = wd_context->get_child_node( name = wd_this->wdctx_cn_tableprop_pvl ).

    • get element via lead selection

    lo_el_cn_tableprop = lo_nd_cn_tableprop->get_element( ).

    IF lv_visiblerow > 0 .

    • get single attribute

    lo_el_cn_tableprop->set_attribute(

    name = `CA_VISIBLEROW_PVL`

    value = lv_visiblerow ).

    ELSEIF lv_visiblerow = 0 .

    lo_el_cn_tableprop->set_attribute(

    name = `CA_VISIBLEROW_PVL`

    value = -1 ).

    ENDIF.

    This will make sure that only 5 rows are visible and rest you have to scroll to see.

    Now if you want that out of 6 rows added to the table , last 5 rows should be visible then :

    Create a Context Attribute of type I "LEAD_SELECTION" and bind this to firstVisibleRow property of table .

    Write this code:

    • Get the number of rows in table ****

    DESCRIBE TABLE it_selected_hcp1 LINES lv_count.

    DATA lo_el_context TYPE REF TO if_wd_context_element.

    • Set the lead selection to last row *****

    lo_el_context = wd_context->get_element( ).

    lo_el_context->set_attribute( name = `LEAD_SELECTION` value = lv_count ).

    lo_nd_cn_entertainment->set_lead_selection_index( lv_count ).

    This will work.

    Edited by: Saurav Mago on Oct 9, 2009 3:16 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 09, 2009 at 09:48 AM

    Hi Soumya ,

    do u wish only 5 rows to appear of ur table ? if so ,

    there is a tutorial on SDN "PROGRAMMING THE ALV CONFIGUIRING MODEL"

    refer this link :

    SAP List Viewer (ALV) [original link is broken]

    I hope that tutorial can help u

    regards,

    amit

    Add comment
    10|10000 characters needed characters exceeded