on 06-02-2009 8:26 AM
Hi,
I have a tebstrip with 4 tabs and a button in my view
if i click the button the tab 1 should be selected in the tabstrip.
please let me know how to do this in codeing.
Regards,
Kumar K
Say suppose I have a context node by name NODE & an attribute by name SELECTEDTAB of type STRING under this node. I bind the selectedTab property of my TabStrip to this context attribute. (i.e., MAIN.NODE.SELECTEDTAB ) Now I place a button and create an action handler for this SET_FOCUS_ONTAB1. Below is the coding for my buttons action handler:
METHOD onactionset_focus_ontab1 .
DATA: wd_node TYPE REF TO if_wd_context_node.
wd_node = wd_context->get_child_node( name = 'NODE' ).
wd_node->set_attribute( EXPORTING name = 'SELECTEDTAB'
value = 'TAB1' ).
ENDMETHOD.
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Uday,
actually i know that. but i want do it with out node and attribute.
if i start createting node and attributes for each properties it will reach nearly thousand for
single view.
I think we can code without node or attribute is pretty good.
But i dont know which is best ..
please let me know shall wether i create Node attributes for each properties like tab_strip.
or can i do the same without node and attribute.
Regards,
Kumar K
Hi Kumar,
This is the approach suggested by SAP. Whenever you want to modify any particular property of an ui element we need to have it bound to some context attribute & we modify the value of this context attribute. We can even do it using dynamic programming but this way we would end up changing the ui elements properties in a method other than the WDDOMODIFYVIEW which is strongly not suggested. However am just giving you the methodology & code for the dynamic programming approach code just for your understanding:
1) Fetch the reference of your tabstrip by passing its ID within your WDDOMODIFYVIEW
2) Save the reference obtained in a view level attribute
3) Now within your action handler method just use this reference to set the desired tab as selected
Regards,
Uday
method WDDOMODIFYVIEW .
check first_time = abap_true.
" Fetching the reference of the tabstrip. My tabstrip id is TABSTRIP
wd_this->gv_tabstrip ?= view->get_element( id = 'TABSTRIP' ).
endmethod.
METHOD onactionset_focus_ontab1 .
" Use the earlier obtained reference to set the first tab as selected
" My first tab's id is TAB1
wd_this->gv_tabstrip->set_selected_tab( value = 'TAB1' ).
ENDMETHOD.
Hi Kumar,
This is easy. Just create a context attribute of type STRING & bind it to the selectedTab property of your TabStrip. Now when the user presses on the button just set the value of this context attribute to the ID of your first tab.
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.