cancel
Showing results for 
Search instead for 
Did you mean: 

Node Lead selection problem after sorting

ashish_shah
Contributor
0 Kudos

Hi Experts,

I am using comparator class for sorting multiple columns of a node.

i have created total 3 classes.

1)GenericNodeElementComparator

2)OrderingAttribute

3)OrderingExpression

as per valery's suggestion in the following thread

[]

I am using the following code to sort my node.

ABCNode.sortElements(new GenericNodeElementComparator(

new OrderingExpression().asc("ele1").asc("ele2").desc("ele3")));

After sorting, the lead selection of the node remains on the third row.

when i am trying to forcefully set the lead selection to first node by

ABCNode.setLeadSelection(0);

For display purpose the lead selection is set to the first row in the table.

How ever when i fetch the node's element data using the code

ABCEle = ABCNode.getABCElementAt(wdContext.nodeABC().getLeadSelection());

ABCEle.GetEle1();

it gives me the value of the third element and not the first element.

the statement wdContext.nodeABC().getLeadSelection() gives value 0.

How can i set the node lead selection element to the first element shown in the display in table?

Regards,

Ashish Shah

Accepted Solutions (0)

Answers (2)

Answers (2)

ashish_shah
Contributor
0 Kudos

Thanks Guys for helping.

The error was not in the sorting.

In the controller when i was setting the lead selection to the first element it was not getting set properly.

When i tried to set the leadselection in the view i was able to successfully achieve the desired result.

Former Member
0 Kudos

Hi,

Can you try with the following code:


wdContext.nodeABC().getCurrentElement();

Regards,

Satyajit.

ashish_shah
Contributor
0 Kudos

Hi Satyajit,

I tried with the code :

wdContext.nodeABC().getCurrentElement();

however still the same result.

It seems the node's default selection is on the third element.

So even if i change the lead selection using SetLeadSelection method.

It changes the lead selection only for the display purpose. where as the lead selection pointer is still on the third element.

Interesting thing here is , if i click on the table row in display then the leadselstion is correct.

first record shows the leadselection as 0 and second 1 and so on...

Any clue on how to reset the pointer of the leadselection and then make it point to the first element?

Thanks

Ashish shah

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi Ashish,

Default first row will be selected. You can also set row selection by giving row number.

code : wdContext.node<Table>().setLeadSelection(0);

Regards, Suresh KB

ashish_shah
Contributor
0 Kudos

Hi Suresh,

I am already using the code

wdContext.node<Table>().setLeadSelection(0);

The problem here is after sorting the node, using the code in my first post in this thread ,

the lead selection stays on the third node.

using the code wdContext.node<Table>().setLeadSelection(0); for display purpose in a table the lead selection moves to the first record,

but when i fetch the data using the code

wdContext.node<Table>().Get<Table>Elementat(wdContext.node<Table>().getLeadSelection());

it still returns the third element.

Can you suggest a solution to this?

Regards,

Ashish Shah.

Former Member
0 Kudos

Hi,

Have a go with this:


//after sorting...
//clear all selections
wdContext.node<Table>.setLeadSelection(IWDNode.NO_SELECTION);
wdContext.node<Table>().clearSelection();

//set selections now
wdContext.node<Table>().setSelected(0,true);
wdContext.node<Table>().setLeadSelection(0);

Regards,

Satyajit.

ashish_shah
Contributor
0 Kudos

Hi Satyajit,

Tried to clear the selection using

wdContext.node<Table>.setLeadSelection(IWDNode.NO_SELECTION);

wdContext.node<Table>().clearSelection();

But still the leadselction shows the third element selected.

Do i need to change anything in the property of the node?

like selection cardinality or initialized leadselection ?

Ashish shah