cancel
Showing results for 
Search instead for 
Did you mean: 

Using multiple selection without using the lead selection???

Former Member
0 Kudos

Hi there everybody,

I have a model node defined with the following proprties:

- cardinality = 0..n

- selection = 0..n

- initializeLeadSelection = false

That model node is in the comp. control. and the view controller is linked to it.

I display that node in a table ui element.

Table is defined with:

- selection = auto (I have tried multi also, it didn't change anything)

I want to use only the feature of node selection (without the leadselection) --> I want the user to select the rows, one by one, using the node selection, without the lead selection (Also, I don't want him to press CTRL in order to select the rows in the table...)

The main idea is that I don't want to user feature of the node Lead Selection at all. It will just confuse the user.

Also, I have set the initializeLeadSelection as "false" on the context model node and it didn't change anything, the row in the table is still highlighted as the lead selection. (I know I can do it using the <node>.setLeadSelect(-1..). I just wonder why it didn't work while setting the initializeLeadSelection.

Ideas / Suggestions will be appreciated and rewarded.

Regards,

Yair Leshem

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Yair,

Nothing wrong here -- this is expected WD behavior.

And there is no way to disable lead selection in table without disabling multiple selection as well.

As you said yourself, just write onLeadSelect action handler that converts lead selection to mutli selection and reset lead selection.

VS

Former Member
0 Kudos

Thanks for the quick response Valery.

I've tried to write onLeadSelect which will convert the lead selction to the node selection, it worked.

However... there is one more problem...

When converting the lead selection to node selection I want the scenario to be like this:

A user clicks a row and then another one and so on...

I want the square on the side of the table to act just like a checkbox.

e.g. rows that were selected to still be selected after the roundtrip, and if I've selected one of the rows arleady, I want it to be unselected.

For some reason, the code I've write didn't work, do u mind to have a look?

Even after adding the first loop, the only row that stayed selected was the one selected.

If i wanted the other rows to be selected I'd had to use the CTRL button + mouse click / spacebar

I've even selected it again


{
	// "Reselecting" the selected nodes
	for (int i = 0; i < wdContext.nodeZZZ().size(); i++)
	{
		if (wdContext.nodeZZZ().isMultiSelected(i)
		{
			wdContext.nodeZZZ().setSelected(i,true);
		}

	}

	// Reselect the current element if it was not selected already
	int leadSel = wdContext.nodeZZZ().getLeadSelection();
	if (!wdContext.nodeZZZ().isMultiSelected(leadSel)
	{
		wdContext.nodeZZZ().setSelected(leadSel,true);
	}	

	// Reset the Lead Selection
	wdContext.nodeZZZ().setLeadSelection(IWDNode.NO_SELECTION);
}

and the last thing is that the context's property of initializeLeadSelection is set to false and there is still a lead selection.

BR,

Yair Leshem

Former Member
0 Kudos

Hi, it has been a while since the last post, so i dont know if you managed to solve it. i also use web dynpro 6.4 and i'm not sure if 7 addresses this. This is how i did it.

I created a context vector, and if i select a row, i'll assign it to the vector, and if i select it again, i will remove it from the vector. i'll also loop through the vector to determine which rows i've selected.


wdDoInit(){
        wdContext.currentContextElement().setMultipleSelectionVector(new Vector());
}

onActionMultipleSelect(){
	Vector MSV = wdContext.currentContextElement().getMultipleSelectionVector();
	int lastEntry = 0;
	for (int i = 0; i < MSV.size(); i++){
		lastEntry = Integer.parseInt((String) MSV.get(i));
		wdContext.nodeXXX().setSelected(lastEntry,true);
	}
	if(	MSV == null || !MSV.contains(String.valueOf(wdContext.nodeXXX().getLeadSelection())))
	{
		MSV.add(String.valueOf(wdContext.nodeXXX().getLeadSelection()));
		wdContext.nodeXXX().setSelected(wdContext.nodeXXX().getLeadSelection(),true);
	}else{
		MSV.remove(String.valueOf(wdContext.nodeXXX().getLeadSelection()));
		wdContext.nodeXXX().setSelected(wdContext.nodeXXX().getLeadSelection(),false);
		wdContext.nodeXXX().setLeadSelection(lastEntry);		
	}
}

Answers (0)