cancel
Showing results for 
Search instead for 
Did you mean: 

How to set number of Rows of a table to be displayed based on user action?

Former Member
0 Kudos

Hi Experts,

I am getting data into the table. But only 5 records are displayed default. I want it to be a user selection.

If user wishes to see 10 records, then first 10 records should get displayed. If user selects 'n' records then 'n' records should get displayed..

How to achieve this?

Regards,

Yugesh A.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

Use visible row count property of table.

Steps would be:

1. Create an input field , bind it with an attribute of type I(Att 2)

2. Ask the user to fill the no of rows to be visible in this input field.

3. After rows to visible are filled , get that number into a local variable.

4. Bind the visiblerowcount property of table with an attribute of type I (Att1)

5. Set the value entered by user into the context attribute Att1.

Answers (4)

Answers (4)

prasenjit_sharma
Active Contributor
0 Kudos

you can make use of the SET_VISIBLE_ROW_COUNT method of the class CL_WD_TABLE. You need to call it in the onAction event on the action, using the table reference. This is a simple process to achieve your functionality.

Let me know if you need more help on this.

Regards

Prasenjit

Former Member
0 Kudos

hi,

do as per the steps and you can code for this either in

OnEnter event of Input field or you have to create a button and write in OnAction of button.

former_member40425
Contributor
0 Kudos

Create an context attribute of type I. Say context attribute name is ctx_rows. Intially You can set any value in the default parameter of context attribute.

Bind this attribute with the input field and the visible row count property of the table.

In the event handler of input field set the value of get(read) the value of this context attribute(Use code wizard to read value).

I hope it helps.

Regards,

Rohit

Former Member
0 Kudos

hi Yugesh ,

1 create a input field UI

2 bind its value property to a attribute

3 suppose ca_check attribute ( type string ) under node cn_check is binded

read this in ur doinit of the view


  DATA lo_nd_cn_check TYPE REF TO if_wd_context_node.
  DATA lo_el_cn_check TYPE REF TO if_wd_context_element.
  DATA ls_cn_check TYPE wd_this->element_cn_check.
  DATA lv_ca_check LIKE ls_cn_check-ca_check.
* navigate from <CONTEXT> to <CN_CHECK> via lead selection
  lo_nd_cn_check = wd_context->get_child_node( name = wd_this->wdctx_cn_check ).

* get element via lead selection
  lo_el_cn_check = lo_nd_cn_check->get_element(  ).

* get single attribute
  lo_el_cn_check->get_attribute(
    EXPORTING
      name =  `CA_CHECK`
    IMPORTING
      value = lv_ca_check ).

4 nw for ur table , make a another context attribute of type either string or I , say attr1

bind its visiblerowcount property of table to attr1

5 make a attribute in ATTRIBUTES tab of type string , say attribute

set its value to lv_ca_check in doinit itself

*

*
wd_this->attribute = lv_ca_Check

6 nw in the method , where u need to validate how m,any rows user enter or doinit itself , set attr1 to the value of that attribute created under ATTRIBUTES tab ( named attribute)


DATA : lv_count type string .
lv_count = wd_this->attribute

7 nw its very simple , set attr1 to lv_count , as it contains the count of the number which has entered in the input field


 DATA lo_nd_cn_check TYPE REF TO if_wd_context_node.
  DATA lo_el_cn_check TYPE REF TO if_wd_context_element.
  DATA ls_cn_check TYPE wd_this->element_cn_check.
  DATA attr1 LIKE ls_cn_check-ca_check.
* navigate from <CONTEXT> to <CN_CHECK> via lead selection
  lo_nd_cn_check = wd_context->get_child_node( name = wd_this->wdctx_cn_check ).

* get element via lead selection
  lo_el_cn_check = lo_nd_cn_check->get_element(  ).

* set single attribute
  lo_el_cn_check->set_attribute(
    EXPORTING
      name =  `attr1`
   
      value = lv_count ).

I hope it shud help

proceed like these , u wud be able to achieve the desired functionality

regards,

amit

Edited by: amit saini on Oct 20, 2009 1:12 PM