on 06-14-2007 12:57 PM
hi all...
I have a standard table...
In which i want to select 1 column....
Is there any way by which i can recognize which column has been selected...
jagruti..
Hi Jagruti
In Standard Table you don't have this automatic column select functionality, how ever you can set onAction of Table Column to an event handler and you can set a variable inside the event handler and in WDMODIFYVIEW you can code as follows
to make that column as selected.
the code follows:
data: lr_table type ref to cl_wd_table.
data: lr_tab_column type ref to cl_wd_table_column.
if <the column> selected.
lr_table ?= view->get_element( ID = 'TAB' ).
lr_tab_column = lr_table->get_column( ID = 'TAB_NACHN' ).
lr_tab_column->set_cell_design( value = '06' ).
endif.
by default cell design will be '01' for columns.
you can have different values for this cell desing which you can find in WDUI_TABLE_CELL_DESIGN data element.
Regards
Abhimanyu L
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
the id of the selectd column is the ID you find in the view designer in the properties tab in the field ID (the name you gave to it).
This id will be transmitted to the action handler of onAction. You can read this ID as described above.
You could set this ID as attribute in the view controller in the action handler.
In onModify you could then read this ID e.g. wd_this->selected_column and use this ID with the code provided by ABHI.
Cheers,
Sascha
Message was edited by:
Sascha Dingeldey
its up to you .. i think it is easier to define an attribute in the view controller (attributes tab of the view) for example selected_column type string.
in th action handler set this id
wd_this->selected_column = id.
Then in wddomodifyview use wd_this->selected_column to change the look of the column like abhi told you. But this only changes the look.
But you also can use a context node to store the id of the selected column.
Cheers,
Sascha
Let me tell u wht im doing..
I gave an event hadler Display for all columns..
lv_col_id is an attribute in the view
1) ONACTIONDISPLAY
wd_this->lv_col_id = wdevent->get_string( 'ID' ).
2)WDMODIFYVIEW
data: lr_table type ref to cl_wd_table.
data: lr_tab_column type ref to cl_wd_table_column.
lr_table ?= view->get_element( ID = wd_this->lv_col_id ).
lr_tab_column = lr_table->get_column( ID = wd_this->lv_col_id ).
lr_tab_column->set_cell_design( value = '06' ).
Im getting a dump...
access via null pointer ...
wht am i missing..
Hi Jagruti.
You use the column id for getting the table:
lr_table ?= view->get_element( ID = wd_this->lv_col_id ).
I guess the ID of the table is something different. This way lr_table will be NULL. Pls check the ID of the table in view designer and set it hard coded.
For example:
lr_table ?= view->get_element( ID = 'THE_TABLE' ).
Hi.
You could get the data by reading all elements of the table and depending on the
column ID read the corresponding bound property in a case in the action.
node->get_elemets( ).
loop all elements.
case column_id
when x
element->get_attribute( x ).
when y.
element->get_attribute( y ).
...
enndcase.
to deselect the previous selection in wddomodify you would need a new attribute for the previous col id.
ind the action first of all you would set
wd_this-old_col_id = wd_this->col_id
then wd_this->col_id = wdevent->get ...
then in wddomodify:
lr_table ?= view->get_element( ID = 'TABLE' ).
if wd_this->old_id is not initial.
lr_tab_column = lr_table->get_column( ID = wd_this->old_id ).
lr_tab_column->set_cell_design( value = '01' ).
endif.
lr_tab_column = lr_table->get_column( ID = wd_this->col_id).
lr_tab_column->set_cell_design( value = '06' ).
Cheers,
Sascha
Hi Jagruti.
come on ...
if you have a node
node
- attribute2
- attribute2
and you bind this node to your table you have for example
one column called col1 bound to attribute1
and the second column called col2 bound to attribute2
then
case col_id
when col1
element->get_attribute(
EXPORTING
name = 'ATTRIBUTE1'
IMPORTING
value = item_attribute1 ).
when col2
element->get_attribute(
EXPORTING
name = 'ATTRIBUTE2'
IMPORTING
value = item_attribute2 ).
endcase.
where item_attribute1 or item_attribute2 are attributes of the corresponding trype.
Cheers,
Sascha
Hi Jagruti
To Get Header Content of the Column
data: lr_table type ref to cl_wd_table.
data: lr_tab_column type ref to cl_wd_table_column.
data: lr_caption type ref to cl_wd_caption.
data: str type string.
lr_table ?= view->get_element( ID = 'TAB' ).
lr_tab_column = lr_table->get_column( ID = 'TAB_NACHN' ).
lr_caption = lr_tab_column->get_header( ).
str = lr_caption->get_text( ).
Now str has the content of the header of the Column TAB_NACHN
Regards
Abhimanyu L
Ya i did that..its working fine...
But im now creating dynamic columns..
Like when i click on insert column button im getting a new column..
So im not able to set the header for the cloumns..
and the same thng i want to do with the dynamic columns ie registe ran event handler for selecting the column..
can i do that..
jagruti
hello sascha
DATA: str TYPE string.
DATA: lt_columns TYPE cl_wd_table_column=>tt_table_column,
ls_column TYPE REF TO cl_wd_table_column,
col LIKE LINE OF lt_columns.
lr_table ?= view->get_element( id = 'TABS' ).
lt_columns = lr_table->get_columns( ).
LOOP AT lt_columns INTO ls_column.
case ls_column->id.
when 'MLDU000001'.
lr_caption = -
-
-
-
-
-
-
get_header( ).
lr_caption->set_text( ' MLDU000001' ).
endcase.
ENDLOOP.
This is wht im doing ...TABS is the name of my dynamic table..
in lr_caption = get_header( )..
wht reference shud i use...
like ls_column-______->get_header( ) ..
jagruti..
Hi Jagruti.
When you select the table column (TabelColumn Ui Element) in the view designer
you can create an action for the onAction event of this column.
But seems that you have to create one handler per column so that you can find out which column was clicked.
The event is triggered when the user clicks the header of the column.
Cheers,
Sascha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi.
Yes Koen is rite.
You can build one action for all columns and assign this action to all colums.
In the action you can find out which column was clicked as follows:
data:
lv_col_id type string.
lv_col_id = wdevent->get_string( 'ID' ).
lv_col_id is the ID of the selected column then.
Sorry
Cheers,
Sascha
In the view designer you can set the same action for each table column in the event onAction.
Koen, if the cell editor is an text view you can not set any action. Or an input field as cell editor only has the event onEnter which is not triggered swhen the user clicks the cell. So I guess using the event of the column is the only way.
Cheers,
Sascha
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.