on 12-20-2005 6:13 AM
hi
my name is praveen
my question iam designing a form related to webdynpro
in that iam creating two dropdownbyindex in that
1.userid2.Material id
sub: i require code samples and binding
i have to select the items form those and
1button:insert
2button:Retrieve
3buttton:delete
4thbutton:update
i have to click those buttons so that i can display in smae page in same table those upadates.
please tell me my questin to answer very immediately
because we are facing about code samples
hi,
check out the link it explains u about all dropdownbyindex ui element
View Programming UI and Navigation
map the dropdownbyindex to value attribute which is inside a value node.
this code is for giving value to dropdown
public void wdDoInit()
{
//@@begin wdDoInit()
String[] letters = new String []
{"A", "B", "C", "D"};
//Create context elements for the node "X"
List nodeElements = new ArrayList();
for (int i = 0; i <letters.length; ++i)
{
IPrivateTestView.IXElement xElement =
wdContext.createXElement();
xElement.setY(letters<i>);
nodeElements.add(xElement);
}
//Bind node element list to the node
wdContext.nodeX().bind(nodeElements);
//Set nodes lead selection which determines the selected item
wdContext.nodeX().setLeadSelection(1);
//@@end
}
This is for seeing the value in dropdown once u enter inside the IE.If u want this is to be triggered only on clicking of the button
then give this code inside ur onsubmit() action of the buton.
hope this helps u,
Regards,
Arun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen,
Go to layout of the view Create dropdownbyindexUI element
Create a node_userid having the attribute user_id and bind that attribute to texts property of the dropdown
write this code in doinit to populate values to the node
If all user ids are in an vector userid_vec
for (int i = 0; i <userid_vec.size; ++i)
{
IPrivateApplicationView.Inode_useridElement element = wdContext.createnode_useridElement();
element.setAtt1(userid_vec.ElementAt(i));
wdContext.nodenode_userid().addElement(element);
}
bind an action to property onSelect. you can access the index of the selected element in the event handler in implementation
wdContext.nodenode_userid().getLeadSelection();
Link the onAction property of button to an action
Create an element of the node to which you should add these values
IPrivate<view name>.I<node name>Element element = wdContext.create<node name>Element();
element.set<attribute name>(wdContext.nodenode_userid().getElementAt(wdContext.nodenode_userid().getElementAt(wdContext.nodenode_userid().getLeadSelection()).getAttributeValue(" user_id").toString());));
wdContext.node<node name>().addElement(element);
Like this for deleting you can loopthrough the node from which you have to delete and identify the element
int index = 0;
for(int i = 0;i<wdContext.node<node name>().size;i++)
{
wdContext.node<node name>().get<node name>Elementat(i).getAttributevalue("user_id").equals(<Selected element>)
index = i;
}
Once you get the element you can remove it from table
wdContext.node<node name>().removeElement(wdContext.node<node name>().get<node name>ElementAt(index)
For update you once you get the index you can go to the element and modify it
What do you mean by retreiving the element?
Hope this helps you
Regards
Rohit
hi,
sir
this is not my requirement
i asked to yu to
1:user id:inputfield
2:materialall:inputfield
below table
here buttonns are
1:insert: these are inseting
but whatever we are selecting form dropdownbyindex
those ar diplayed
but
2> if i will enter new elements in inputfield
those are not inserted in table
3: in table those are displayed in only one column
next column these elements are not inserted thery are not incremented
what is the code for that
byeeeeee
Hi,
This will display the value in the dropdown by index.
String[] name=new String []{"name1","name2","name3"}
for(i=0;i<3;i++)
{
IPrivateMainview.INode_userElement x1=wdContext.nodeNode_user().createNode_userElement();
wdContext.nodeNode_user().addElement(x1);
wdContext.currentNode_userElement().setuser(name<i>);
wdContext.nodeNode_user().moveNext();
}
in the onselect method of the dd by index,
get the selected value.
String name=wdContext.currentNode_userElement().getuser();
Then set to the table attribute...
Regards,
Vijayakhanna Raman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen,
Go to layout of the view Create dropdownbyindexUI element
Create a node_userid having the attribute user_id and bind that attribute to texts property of the dropdown
write this code in doinit to populate values to the node
If all user ids are in an array userid_array
List nodeElements = new ArrayList();
for (int i = 0; i <userid_array.length; ++i)
{
IPrivateApplicationView.Inode_useridElement element = wdContext.createnode_useridElement();
element.setAtt1(letters<i>);
nodeElements.add(element);
}
// Bind node element list to the node
wdContext.nodenode_userid().bind(nodeElements);
bind an action to property onSelect. you can access the index of the selected element in the event handler in implementation
wdContext.nodenode_userid().getLeadSelection();
Link the onAction property of button to an action
Create an element of the node to which you should add these values
IPrivate<view name>.I<node name>Element element = wdContext.create<node name>Element();
element.set<attribute name>(wdContext.nodenode_userid().getElementAt(wdContext.nodenode_userid().getElementAt(wdContext.nodenode_userid().getLeadSelection()).getAttributeValue(" user_id").toString());));
wdContext.node<node name>().addElement(element);
Hope this helps you
Regards
Rohit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi praveen
could you be more specific in ur scenario where ur dropdownby index is and about the buttons insert delete.
Do u want to insert or delete rows of a table.
Regards
Rathna.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
sir
my problem
is i will take one dropdownbyindex i will display userid
in that,second dropdownby index display material id
then i will display whole in below table
2: if i design one input field then i will enter userid
for creation that will be created in database
3.same if i delete that id it will reflect that database
4. if retrive all the details of userid
it will display in table
hi,
sir
this is not my requirement
i asked to yu to
1:user id:inputfield
2:materialall:inputfield
below table
here buttonns are
1:insert: these are inseting
but whatever we are selecting form dropdownbyindex
those ar diplayed
but
2> if i will enter new elements in inputfield
those are not inserted in table
3: in table those are displayed in only one column
next column these elements are not inserted thery are not incremented
what is the code for that
byeeeeee
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.