cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding action event on view Switch of ContextualPanel

Former Member
0 Kudos

Hello Friends,

This is the first time i am using view switch....now when i am clicking on view switch say 'Genaral'.....i have written the code in action event of general but stilll its not triggering...can you pls tell me any specific thing is needed for this UI element to work.

I have binded the property itemSource with corresponding node.

Thanks

Kiran

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Kiran,

i assume you have written your code onselect event handler method.

which context node is binded to the itemSource property of the viewSwitch ?. how many elements are there ?

is itemenabled property also binded ? or is it default enabled ?.

see the help here [http://help.sap.com/saphelp_nw70ehp1/helpdata/en/28/fe5a42091de32ce10000000a1550b0/content.htm|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/28/fe5a42091de32ce10000000a1550b0/content.htm]

The view switch is not automatically toggled. There is an INDEX parameter containing the index of the selected view switch

also see the example WDR_TEST_EVENTS in the view ContextualPanel

Former Member
0 Kudos

See my solution in this thread [|]

Former Member
0 Kudos

Hello Baskaran,

I got your point but don't know how to get this event parameter INDEX .Sorry for bothering you......pls tell me the steps.....

Thanks

Kiran

Former Member
0 Kudos

Hi,

on_select event handler, you can insert INDEX type i as importing parameter.

data node type ref to if_wd_context_node.

" This has so to be done manually

node = wd_context->get_child_node( wd_this->wdctx_yournodename ).

node->set_lead_selection_index( index ).

This should work, but you said that the action itself is not triggerred. Try this code if this is still not working then you should check the node which you bind to itemSource if there is any restriction in cardinality,selection etc.

You should also check the enabled property of the view switch if it true.

Former Member
0 Kudos

Hi Baskaran,

still not working.

node properties are:

Cardinality: 1..1

Selection: 0..1

Init. LS : yes

Former Member
0 Kudos

>

> Hi Baskaran,

>

> still not working.

> node properties are:

>

> Cardinality: 1..1

> Selection: 0..1

> Init. LS : yes

Ok, i see it. it wont work. ViewSwitch is already selected if you are having cardinality 1..1 and init.LS TRUE.

The business case is to use 0..n or 1..n cardinality to have a viewSwitch and on_select event to trigger.

Since in your case, 1..1 and initial lead selection is true, you would not get this event triggered. You could set init.LS to false to get this on_select event to trigger but this will work once until you set the lead selection to no_selection.

Former Member
0 Kudos

Hello Baskaran,

I tried it also but while i am testing the application i am getting this error:'The ASSERT condition was violated'

Former Member
0 Kudos

>

> Hello Baskaran,

>

> I tried it also but while i am testing the application i am getting this error:'The ASSERT condition was violated'

Hi,

Please write always more detail so that we do not misunderstand. It could be because you might have changed the Initialize lead selection. Change that back and test if it works.

If your concern here is to still keep 1...1 node binded to view switch and trigger event then you have to find another way to trigger the server round trip (button, etc ).

Former Member
0 Kudos

Absolutely correct...same thing i tried using buttons..all is working fine but not with viewSwitch

Former Member
0 Kudos

Then please do not try to get it worked when it is not designed to work that way. You can better spend your time on other things.

Answers (1)

Answers (1)

gill367
Active Contributor
0 Kudos

ok

put a breakpoint in the eventhandler and check.

it should be going there or you might have given the name of some other action.

thanks

sarbjeet singh

Former Member
0 Kudos

Hello Sarabjeet,

I have checked but its not triggering.I mean to say that action is not working thats why when i tested with breakpoint....its not going there.

gill367
Active Contributor
0 Kudos

put a breakpoint in wddomodify and check whether it is going there

Former Member
0 Kudos

Hello Sarabjeet.....no its not going there also

Former Member
0 Kudos

when the screen is coming up how many elements are there in the viewswitch ? the action is not triggered only when the itemEnabled property is false.

I have just executed a test, it is working perfectly. So you have to go through your code and layout to check if you have done everything right.