on 04-15-2008 12:22 PM
Hi All,
I have created a dynamic table which fetches data from R/3.
My requirement is to change the particular cell value .
Ex:
Desc
A
B
I want to replace this A value with C value.
How to access this particular cell value?
Pls note that everything is dynamic.
pls suggest.
Regards,
Subashini.
Hi Ayyapparaj,
Thanks for your reply. I tried with your code. But its replacing only the entire column since I am destroying the table cell editor and passing link to action object. I have created a dynamic table which contains link to action for particular column. I have to replace the particular cell value with another value.
Ex:
String colVal = //getting value from the bapi
IWDAction act = wdThis.wdGetAction();
IWDLinkToAction action = (IWDLinkToAction)view.createElement(IWDLinkToAction.class,null);
action.setText(colVal);
action.setEnabled(true);
action.setOnAction(act);
action.setVisible(WDVisibility.VISIBLE);
column.destroyTableCellEditor();
column.setTableCellEditor(action);
Output:
A(link to action)
B(link to action)
Now I have to replace A value with C value.
Pls help me. Its very urgent.
Regards,
Subashini.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Subhasini,
While creating link to action , give some uniqe id to it instead of null.
IWDLinkToAction action = (IWDLinkToAction)view.createElement(IWDLinkToAction.class,"Action" + i );
Here ' i ' is the count (integer).
this way you can access the particular element again as follows-
IWDLinkToAction action1 = (IWDLinkToAction)view.getElement("Action" + i );
Now set all the values in action1 as you want.
action1.setText(colVal);
.....
......
Now set the table cell editor to action1.
column.destroyTableCellEditor();
column.setTableCellEditor(action1);
Thanks and Regards
Deepak
Hi Armin,
Thanks for your reply. Yeah, what you said is correct. I am getting the same value for each row.
if(fieldName.equalsIgnoreCase("Zzbus_Unit_D")){
IPrivateView.IbapiNode bapiNode = wdContext.nodebapiNode();
IWDLinkToAction action= null;
for(int index=0;index<wdContext.nodebapiNode().size();index++) {
IPrivateView.IbapiElement bapiElem = bapiNode.getbapiElementAt(index);
IWDAction act = wdThis.wdGetAction();
action = (IWDLinkToAction)view.createElement(IWDLinkToAction.class,null);
if(bapiElem.getZzbusuni_Fkkopru()== null || ( (bapiElem.getZzbusuni_Fkkopru().equalsIgnoreCase("") && bapiElem.getZzbusuni_Fkkopru().length() == 0))){
IPrivateView.IbapiElement hyphenElem = bapiNode.getbapiElementAt(index);
hyphenElem.setZzbus_Unit_D("-");
colVal = hyphenElem.getZzbus_Unit_D();
action.setText(colVal);
}
else{
colVal = bapiElem.getZzbus_Unit_D();
action.setText(colVal);
}
action.setEnabled(true);
action.setOnAction(act);
action.setVisible(WDVisibility.VISIBLE);
column.destroyTableCellEditor();
column.setTableCellEditor(action);
}
}
Where am I doing wrong?
Pls help me.
Regards,
Subashini.
First, ask yourself: Do I really need to recreate the view layout when data change or do I just have to update the context values to which the UI elements in my view layout are bound.
In this example, you could maybe use a Table instead of creating the LinkToAction elements programmatically?
In your code, it seems you should do something like
action.bindText("bapi.Zzbus_Unit_D");
Armin
Hi Armin,
I am setting hyphen for particular cell value by using the following code:
I am creating an element for the bapiNode and then setting hyphen value to it.
hyphenelement is an element for the bapiNode
hyphenelement.set<bapiattrname>("-");
String colVal = hyphenelement.get<bapiattrname>();
action.setText(colVal);
Based on some condition am setting this hyphen value.
Otherwise I will set the values from the bapi like the below:
action.bindText(bapiNode.attrname);
As you said, setText is giving same value for each row if I perform any click event.
Since I am using setText to set the hyphen ,I am getting hyphen in the entire column if I click any button on the same page.
Is there any other method to set the hyphen for the particular cell value?
Pls guide me.
Regards,
subashini.
hi,
suppose you have 2 rows and 3 columns(name, id, age) and you want to change the value of the age cell in the 2 nd row.....then you can use the following code
//looping witht the size of the node, that is the no. of rows
for(int i=0;i<wdContext.nodeEmpNode().size();i++)
{
IEmpNodeElement element =
wdContext.nodeEmpNode().getEmpNodeElementAt(i);
//getting the second row as per my snenario
if(i=1)
{
//changign the value of the cell age int he 2nd row
element.setAge(c);
}
}
regards,
pinki
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi pinki,
Thanks for your reply. I am fetching the values from the R/3. So it is not allowing me to set the value for the specific attribute as you mentioned.
I am creating a table dynamically by binding the node from the R/3. I am not creating any context node separately.
Is there any other way to change the particular cell value?
Pls suggest.
Regards,
Subashini
Hi Subhasini,
I am not expert in dynamic programming but still you can try if you want. Instead of setting the text through code action.setText(colVal); try binding the text using action.bindText() code. You have to pass the attribute info of the attribute (Attribute A, i believe) of dynamically generated node as the parameter to bindText method. And then follow Ayyaparaj's or Pinki's code to set the data.
Regards,
Gopal
hi,
u might have created a action for the LinktoAction UI Element. while creating the Action u might have given the text for the Action.if yes then please remove the text value in the Action method as i had a similar problem of binding the text TableCellEditor.
when u want to set the value "C" to A , destory the LinkToAction Ui Element and
again create alink toAction Ui Element and Bind the text withe Value "C". finally bind the Action to the LinkToAction UI Element.
Thanks and regards
Fistae
Hi,
You have to access the element which shows this cell value and change it
Ex:
wdContext.node<YourNode>().setLeadSelection(<row which contains the cell>);
wdContext.current<Your Nodeelement>().setAttributeValue(attributename, value);
OR
I<Your Element> element = wdContext.node<YourNode>().get<Your>Element((<row which contains the cell>);
element.setAttributeValue(attributename, value);
Regards
Ayyapparaj
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 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.