on 02-16-2011 11:14 AM
hi all
I've got a question. I have a webdynpro with a table.
This table is feed by a node. The number of rows of this node is dynamic.
I had seen in the properties of the table object that the number of visible rows can be set.
But is there also a method to set this number of rows dynamicly? So when the node has 20 rows
the table object is also set to show 20 rows and when there are none, the table
only shows the header of the table.
Currently the table always shows 5 rows, without checking how many rows there actually are.
Does any of you know how to do this?
kind regards,
Anton Pierhagen
Hi Anton ,
You can use the method SET_VISIBLE_ROW_COUNT() of the class cl_wd_table for setting the visible row count dynamically.
In the WDDOMODIFY view , you can get the reference of the table UI element used and proceed.
DATA lo_table TYPE cl_wd_table.
lo_table ?= view->get_element( ID = 'name_of_table_in_the_view').
lo_table->SET_VISIBLE_ROW_COUNT(value = 5)."Here the value you can decide based on your data.
But this method is not recommended as it directly deals with the view's elements and will be very difficult for the person maintaining the code.
Instead create a attribute which can store a number and bind the visible row count property to this attribute.
set this attribute with the values based on the data.(as in number of visible rows you would want to see.)
Thanks,
Aditya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is a much easier solution. Just set the number of visible rows properties to -1. This is an alias value that means you want all rows displayed. No reason to go through the dynamic programming that has been suggested here.
Warning: regardless of your approach for doing so, showing all visible rows can lead to performance problems. Depending upon the number of rows this can grealy increase both the network traffic and the page size on the client.
HI
It is possible to do .
create an attribute of type i in the context of the view.
then bind this attribute to the property visiblerowcount of the table.
then check the number of elements in the node and set this attribute.
you can write the code in wddoinit or domodify.
hers is the sample code. my attribute name is 'VISROW' and node name of the table is ZDEALER
data nd type ref to if_wd_context_node.
nd = wd_context->get_child_node( 'ZDEALER' ).
data n type i.
n = ND->GET_ELEMENT_COUNT( ).
WD_CONTEXT->SET_ATTRIBUTE(
NAME = 'VISROW'
VALUE = N
).
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.