cancel
Showing results for 
Search instead for 
Did you mean: 

Some Newbie questions

Former Member
0 Kudos

Hi forum,

I am new to the WebDynpro technology and facing some "strange" problems.

1. Form an input field I am sending some text to my WebService to create an entry in a DB. When I start the Dynpro it works exactly one time, this means that after sending the request the input fields get disabled and I have to restart the Dynpro to send another request to the DB.

This is the code in my Customer Controller looks like this:

public void wdDoInit(){

wdContext.nodeRegisterEmployee().bind(new Request_EmployeeRegisterVIDocument_registerEmployee);

}

public void getRegisterEmployee(){

try{

wdContext.currentGetRegisterEmployeeElement().modelObject().execute();

wdContect.nodeResponseGetRegisterEmployee().invalidate();

}catch(Exception e){}

}

Any idea why?

2. I have a table object that represents the entries in a DB. What I want to do now is, add a checkbox at the end of each row and add a button that deletes the marked entries. What I don’t know is how to get the marked entries in my View?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

First of all thank you for all your answers!

But I still have some problems with the checkboxes:

Here is what I did:

1. Def. a new Value Attibute of type boolean ("check3"). The Value node (Check) has cardinality "0:n" and selection "0:n"

2. Added the check box to a new colum. The Values are "checked -> reference to Node/Attibute", "enabled=true", "id=CheckBox1", "readOnly=flase",

"state=normal",...

3. When starting the Dynpro I can't select any checkbox. Any ideas?

4. Here is the code in my view on the action event of a button:

for (int i = 0; i < wdContext.nodeCheck().size(); i++) {

if(wdContext.nodeCheck().isMultiSelected(i) || i==wdContext.nodeCheck().getLeadSelection()){

long id = 0;

// This line throws an exeption, but first of all, I want to be able to select multible rows

String d = (String) wdContext.nodeGetAllEmployees().getGetAllEmployeesElementAt(i).getAttributeValue("empId");

id = Long.parseLong(d);

wdThis.wdGetEmployeeWSModelCustController().deleteEmployee(id);

}

}

Former Member
0 Kudos

Can you please post the complete context structure and describe how the Table is bound to the context?

Does the value node "Check" contain any node elements when you try to check the checkboxes?

Armin

Former Member
0 Kudos

My Context structure consists of 3 Model Nodes (they represent my WebSerives) and one Value Node (named "Check") with one value Attribute "check3" (type is boolean).

In the View I created a Table Object and selected "create Binding". In the next step I choose the WebService I am using and "Finish". The table "datasource" got bound to the Context of the Controller.

This part works, because I get all the result objects of the WebService displayed (when running the DynPro).

"Does the value node "Check" contain any node elements when you try to check the checkboxes?"

Like I said: The value Node has one Value Attribute that I reference in the Property "checked" of the CheckBox.

One strange thing I noticed is, that when I change the selection and cardinality of the Value Node to "1...n" I can select one row, but when selecting the secound, all rows get selected, except the secound. Any ideas what I am doing wrong.

Former Member
0 Kudos

To add an additional table column with check boxes to an already bound table, do this:

Let X be the node to which the "dataSource" property of the table is bound.

Add new value node "More" as a child of X. Set singleton=false, cardinality=1:1, selection=1:1.

Add attribute "Checked", type=boolean, inside "More".

Now bind the "checked" property of the checkbox (table cell editor of additional column) to context attribute "Checked".

The effect is: For each node <b>element </b>(row) of the existing table, there will be a separate (because of singleton=false) instance of node "More" containing one node element (because of cardinality 1:1). This node element stores the "Checked" value for the corresponding row.

Armin

Former Member
0 Kudos

Thanks Armin,

solved the problem with your help!!!!

Answers (3)

Answers (3)

former_member182372
Active Contributor
0 Kudos

Hi Chris,

1)


public void getRegisterEmployee(){
try{
wdContext.currentGetRegisterEmployeeElement().modelObject().execute();
wdContect.nodeResponseGetRegisterEmployee().invalidate();
.....
wdContext.nodeRegisterEmployee().bind(new Request_EmployeeRegisterVIDocument_registerEmployee());
}catch(Exception e){}
}

Methos invalidate from IWDNode is making:

<i>

/**

  • With this method the node will be invalidated. It clears its element list

  • and calls the supply function again when asked for an element.

  • <p>

  • <b>Warning:</b>This method is not allowed within a supply function.

  • @throws ContextException when called from within a supply function.

*/

void invalidate();

</i>

So, you destroy your all node elements.

2) you need to add new context attribute in your data source context node (checked:boolean) and in button action handler iterate through node, check "checked" attribute and do appropriate action for checked entries.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

1. You have to create a context attribute e.G. a string

that can you choose in the propety text of the inputfield

And now you can work with the context attribute.

Thats how I am doing it and it works.

2. For multible selection you must change the selection

property of the value node to 0..n

Former Member
0 Kudos

>

> 2. I have a table object that represents the entries

> in a DB. What I want to do now is, add a checkbox at

> the end of each row and add a button that deletes the

> marked entries. What I don’t know is how to get the

> marked entries in my View?

a)Set 'selection' property of value node to "0..n".

b)for (int i = 0; i < wdContext.nodeElem().size(); i++) {

if (wdContext.nodeElem().isMultiSelected(i) ||

(i == wdContext.nodeElem().getLeadSelection()) ...

}