cancel
Showing results for 
Search instead for 
Did you mean: 

is there any event when the lead selection changed?

Former Member
0 Kudos

is there any event to handle the current line in a table when the lead selection leaves this line?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi wei

you can also retrieve the previous table elements other than the immediately previous one.

instead of using

wdcontext.node<node name>.move previous();

use this one

suppose your intended element is say x above the currently selected element.the change your index

i=i-x;(make sure that value of i is positive)

and use the below code to get that element.

wdContext.node<node name>().get<node name>ElementAt(int index);

may i know why do you want to store the currently selected value in the component controller.

hope this helps

regards

saravana

Former Member
0 Kudos

Hi,

what I want to do is to access the data of the line when the focus is changed from this line to other .

Former Member
0 Kudos

Hi ,

There are no default handlers for this requirment.

We can store the (previous)lead select in a context attribute..

and use that on onSelect..

IN the onSelect event handler use this code..
//Do process - wat u want to do with the prev select
    wdComponentAPI.getMessageManager().reportWarning(wdContext.node<nodename>().get<nodename>ElementAt(<b>wdContext.currentContextElement().getSel_prev()).</b>get<some attr name>());

//Set the current selection
   wdContext.currentContextElement().setSel_prev(wdContext.nodeRole().getLeadSelection());

SO every time u r using the prev selected value and then store the current selection for future access

Regards

Bharathwaj

Message was edited by: Bharathwaj R

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Bharathwaj,

what does this method setSel_prev mean?

Former Member
0 Kudos

Hi Wei Tang,

Sel_Prev is the name of the context attribute i am using..

Regards

Bharathwaj

Former Member
0 Kudos

But in this way, if the element is removed from the table, an error will occur when you try to use the element stored in context attribute.

Former Member
0 Kudos

Hi,

This is not fair.. You never told this requirement anywhere before.. in this post..:)

Ok .. Assuming u delete the element.. what behaviour is intended from the application..

Regards

Bharathwaj

Former Member
0 Kudos

hi wei

declare global variable of type int say int k=0.

and another variable of type int say int j=1;

in the event handler of the lead select method give the following code.

{

if(j==1)

{

int i= wdContext.current<node name>Element().index();

wdContext.node<node name>().get<node name>ElementAt(i);

k=i;

}

else

{int i= wdContext.current<node name>Element(). index();

wdContext.node<node name>().get<node name>ElementAt(k);

k=i;

}

j=j+1;

}

hope this helps

regards

saravana

Former Member
0 Kudos

hi wei

suppose lineA and lineB are in sucession and you want to get access of the previous table element

in the event handler then the following code might be useful.then in the event handler of the lead select method supp

leadselect action method

{

get the index of the current table element corresponding to the leadselection of line B

int i= wdContext.current<node name>Element(). index();

to get the element at line A.

wdcontext.node<node name>.move previous();

wdContext.node<node name>().get<node name>ElementAt(int index);

}

regards

saravana

Former Member
0 Kudos

Hi saravana,

In most cases, however, the two lines are not in succession.

I had ever tried to copy the element currently selected to an attribute in component controller, but it caused some annoying problems.

Message was edited by: Wei Tang

Former Member
0 Kudos

hi wei

can you elaborate your scenario a bit more.

what do you mean by current line.please could you describe it a bit more.

regards

saravana

Former Member
0 Kudos

E.g.

The line A is selected currently. Now if you select line B, is there any event triggered to handle the line A ?

Message was edited by: Wei Tang

Former Member
0 Kudos

Hi,

You can use the lead selection property in table to define actions that are executed when the lead selection changes.

You should write the logic in the implementation in the eventhandler

Regards

Rohit

Former Member
0 Kudos

Hi Rohit,

It's easy to handle the currently selected line, but how to handle the previously selected line?