on 12-29-2008 9:12 AM
Hi,
Can any one tel me How to delete a row on selecting a particular row in a table from Webdynpro.Currently i am display a table during design time and data gets populated at run time and now I want to delete a row on select of that particular row by user.
Please help me out..
Thanks,
Kavitha
Hi Kavitha,
Since you are populating the table dynamically, a row within it can be easily deleted.
Create a button called Remove. This should be visible only when a row is selected. You can achieve that by creating an attribute of type Visibility and binding the visible property of the Remove button to this attribute. You can then set the Visibility attribute using this code where required,
wdContext.currentContextElement().setDownloadButtonVisibility(
WDVisibility.VISIBLE);
Create a new action called Delete and set the onAction property of the Remove button to this action.
Inside that onActionDelete() event handler, you can write something like this,
int i = wdContext.nodeCategory().getLeadSelect();
for(int i=0;i< wdContext.nodeCategory().size();i++){
IPrivateView.INodeCategory node = wdContext.nodeCategory();
IPrivateView.IElement element = wdContext.nodeCategory().getCategoryElementAt(i);
if(wdContext.nodeCategory.isSelected(i)){
node.removeElement(element);
}
}
Hope this helps!
Regards
Kishan
Edited by: kishan chandranna on Dec 29, 2008 11:18 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks to ramesh and Fazal..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
Can any one tel me how can i add checkbox to the table and on selecting those checkbox that particular row should get delete?
Thanks
Kavitha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
create a boolean Attribute and bind it ot the Check box.
if the User selects the check box and clicks on the button remove , we have to remove the checked rows. for this open the Java Editor of the View and in the OnAction method of the Button"remove" , implement the functionality to remove the checked rows .
Thanks and regards
HI
please find the code.
public void onActionClearSelected(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionClearSelected(ServerEvent)
for(int i=0;i<wdContext.nodeCopyAllNode().size();i++)
{
if(wdContext.nodeCopyAllNode().isSelected(i))
{
wdContext.nodeCopyAllNode().removeElement(wdContext.nodeCopyAllNode().getElementAt(i));
}
}
//@@end
}
regards
Manohar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
int i = wdContext.node<yournoe>().getLeadSelect();
for(int i=0;i< wdContext.node<yournoe>().size();i++){
IPrivateView.Inode<yournode> node = wdContext.node<yournoe>();
IPrivateView.IElement elem = wdContext.node<yournoe>().get<yournode>ElementAt(i);
if(wdContext.node<yournoe>.isSelected(i)){
node.removeElement(elem);
}
}
Regards,
Satya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
Add a Button say "Remove" in the View .
Create a Action and bind the action to the OnAction Property of the Button.
In the Java editor of the View, remove the Current Selected Row
for eg :
if (wdContext.nodeTableNode.currentytableNodeElement != null){
wdContext.nodeTableNode.removeElement(wdContext.currentTableNodeElement);
}
where TableNode is the value node bound to the Datasource property of ur table
Hope it helps
Thanks and Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
24 | |
11 | |
9 | |
7 | |
5 | |
5 | |
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.