on 09-18-2013 9:35 AM
Hi All,
There are two ItemList Boxes Say( A,B). I selected an item from List A and once I click on Button the selected item gets added to List B. But I want the selected item to be removed from List A once it gets added to List B.I tried the removeelement but did not work.
wdcontext.nodeA.removeelement(element name);
Also when i select an element in List B and try to remove, always first element is getting selected and removed. Here, i used the above removeelement(element name). The lead selection is always set to 0. I am not able to change leadselection even after selecting other elements. Please help me regarding these two issues.
thanks,
Nooruddin
Hi Nooruddin,
try this way:
wdContext.nodeA().removeElementAt(wdContext.nodeA().getLeadSelection());
Setting the leadselection works this way:
wdContext.nodeA().setLeadSelection(3); // this focuses on the 4th element, since indexing starting from 0
I hope this helps.
Regards,
Ervin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
can you send me the exact line you are typing in?
For instance I can see in your initial description wdcontext which is incorrect, it has to be wdContext (case sensitive).
Another hint:
I also suggest to use the Code Insight feature.
If you enter wdContext and you press the dot (".") then press CTRL+Space then it opens up the possible methods you can type after the dot.
Regards,
Ervin
//@@begin javadoc:wdDoInit()/** Hook method called to initialize controller. */public void wdDoInit(){//@@begin wdDoInit()IPrivateLeadSelCompView.IAElement a; a = wdContext.nodeA().createAElement(); a.setOne("1"); a.setTwo("2"); a.setThree("3"); wdContext.nodeA().addElement(a);a = wdContext.nodeA().createAElement();
a.setOne("4);
a.setTwo("5);
a.setThree("6);
wdContext.nodeA().addElement(a);
}
It behaves in runtime this way:
After first invocation you see this:
Select a line
Press remove
Regards,
Ervin
Try this help document.
It used item list box with drag and drop.
It should fulfill your requirement.
Document:
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0fec52a-abad-2b10-48b8-cbdfd0...
Regards,
Sharath
Also use the parameter mapping for the item list box(similar to mapping for buttons/links) in wdModifyView().
public IWDParameterMapping mappingOfOnLeadSelect()
Returns the parameter mapping for event onLeadSelect
.
To pass UI element event parameter values into action handler parameters,
a parameter mapping has to be defined. Add code like the following inside
method wdDoModifyView()
of the view controller:
if (firstTime)
{
IWDItemListBox myItemListBox = (IWDItemListBox) view.getElement("ID-of-ItemListBox");
myItemListBox.mappingOfOnLeadSelect().addSourceMapping
(
IWDItemListBox.IWDOnLeadSelect.INDEX, // event parameter name
"name-of-action-parameter" // (type int
)
);
}
Hi,
it works with ItemListBox too.
Create an ItemListBox, make sure the parameter MultiSelection is true, assign context A to its datasource and say "two" to its Text property, and try this code in your remove event:
for ( int j = 0; j<wdContext.nodeA().size(); )
if (wdContext.nodeA().isMultiSelected(j))
wdContext.nodeA().removeElementAt(j);
else
j++;
Works like a charm to me.
I added an Itemlistbox rigth below the remove button. The context is the same like the one the table has.
I multiselected (with button CTRL) the 5 and the 8
It is removed from the context and since both the table as well as the Itemlistbox has been bound to the same context, the 2 lines are removed from both the UI elements.
If I had more time I was writing a nicer code, but this one works perfectly.
Cheers,
Ervin
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.