cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot solve problem in course TJA311

Former Member
0 Kudos

Hello!

Perhaps this is not the correct place to ask this question but I take my chanse. I'm sitting with the course material for TJA311 doing some preparation before taking it for real. A colleague of mine has attended it and recommended me to go through the examples in advance in order to have a greater benefit of the course. But I'm stuck in the part of the example where you implement erasing of a row in the table. I have carefully gone through the code and settings but the result of hitting "Delete entry" is just a quick glimpse in the status bar in IE that java script is running. Nothing happens though. Could the problem be in the attributes of the table itself? When I look at the screen shots the rows have a radio button each but my rows have a checkbox(?) instead. When I klick it the row get marked in the sence that the cells of the row get a red frame and the checkbox turns from blue to red. It doesn't however get a mark. Is this the problem? I thought that just marking the row in this way would work and that the screen shots was of another version or so.

Best regards

Benny Lange

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Benny I've taking the course...

If you define an action for the event "onLeadSelect" (available in Properties tab of the Layout), and implement this action it will work.

Regards,

Marc

Former Member
0 Kudos

Hi Marc

I've defined an action named "DeleteEntry" and linked it to the delete button in the ToolBar. I thought that was all I had to do (and the instructions actually doesn't say anything else) but obviously I was wrong. What action should I define for "onLeadSelect"? And do you remember how to add radio buttons to the table? The help function in Wdp doesn't give the answer.

Regards

Benny

Former Member
0 Kudos

To delete the currently (lead-)selected row: In the action event handler, delete the node element at the lead-selection of the table's data source.

Depending on the client you are using (I assume you are using the HTML client), it might be necessary to trigger a server-roundtrip after changing the selected table row. This can be accomplished by binding a "dummy" action to the table's onLeadSelect event.

Perhaps that's what the posters meant.

Armin

Former Member
0 Kudos

Hi again.

I have an event handler called onActionDeleteEntry which is for the action DeleteEntry which is linked to the delete button. It's written as in the example and it looks like this:

    int n = wdThis.wdGetContext().nodePerson().size();
    int leadSelected = wdContext.nodePerson().size();
    
    //loop backwards to avoid index trouble
    for (int i = n-1; i >= 0; --i) {
    	if (wdContext.nodePerson().isMultiSelelcted(i) || leadSelected == i) {
    	    	wdContext.removeElement(wdContext.nodePerson().getElementAt(i));
    	}

I now tried to write a dummy action for the onLeadSelect event but it didn't help.

A related question: do anyone of you know how to write to the console in wpd/Eclipse? It would help immensely to write variables to it and see their values.

Regards

Benny

Former Member
0 Kudos

This code looks familiar to me, but not the line

int leadSelected = wdContext.nodePerson().size();

which should be

int leadSelected = wdContext.nodePerson().getLeadSelection();

This code will delete all selected lines, lead-selected and multi-selected.

Armin

Former Member
0 Kudos

Sorry, you are right. But the reason is that I tested some minor modifications in the code and when I went back in order to copy the original for this topic, I made a misstake. The code was however correctly written in the beginning but to be sure I wrote it in again and it still doesn't work.

Benny

Former Member
0 Kudos

"It doesn't work" means "the selected entries are not removed from the table"?

Check again

- The data binding of the table, table.dataSource etc.

- Binding of Delete-button event to action

- Binding of table.onLeadSelect to dummy action

Armin

Former Member
0 Kudos

Yes, unfortunately it means that the entries are not deleted...

I have checked all the things you mentioned but now I'm fairly convinced that the problem depends on the fact that you are not able to mark a row in a correct way, i.e: I can't make a selection. I think...

I'm a little bit puzzled because I haven't found a way to attache radio buttons to the rows of the table. Shouldn't it be in the configuration? It was with the table in the PDK... "Früh war es viel besser" as our german friends say...

Regards

Benny

Message was edited by: Benny Lange

Former Member
0 Kudos

You do not need to add a selection column with radio buttons or check boxes. If you set the selection cardinality of the table data source node this happens automatically!

For selection cardinality 0:1 (at most one row selected) you get radio buttons, for 0:N (multiple rows selectable) you get check boxes in the first column.

Armin

P.S. Alles wird gut...

Former Member
0 Kudos

In the properties for the table, I have set "selectionMode" to "single". I hope this is the same thing as to set the cardinality. Otherwise I have no clue to where to set it.

Regards and see you tomorrow!

Benny

Former Member
0 Kudos

One more information: when I set "selectionMode" to "none", the "checkboxes" disappears as expected. And when I set the mode to "single" the boxes are there but will not get marked when clicked, as I described before. And also I still don't get the radio buttons (instead of boxes) which I expect when it regards single choices. The interesting things happen when I set the mode to "multi": I get the "checkboxes" (which is expected when you should be able to do multiple choices) but when I click one box, I get a message saying

"An error has occurred:

'Failed to process the request.'"

and an error stacktrace. In the stacktrace the following is stated:

"selection cardinality does not allow multiplenselection"

This is rather odd I think, since I just set the mode to "multi"...

Tired regards

Benny

Former Member
0 Kudos

Hi

Those boxes are not for radioButtond as well as check boxes they are used only to show what is the row that is selected.

To have radio Buttons or check boxes u need to create a separate column and assign check box or radio button UI Element to the table cell Editor. then only u willl get the radio buttons or check boxes .

i think the selection mode has nothing to do with the check boxes or radio buttons

Wishes

Krishna kanth

Former Member
0 Kudos

What is the selection cardinality of the context node that is used for the table's data source? (I suppose it is 0:1)

If you set the table's selection mode to "auto", it will get its value from the data source selection cardinality.

If the data source has selection cardinality 0:N, you can restrict it for the table by using "single".

But you cannot set the table selection to "multi" if the data source only allows single selection (0:1).

Armin

Former Member
0 Kudos

Hi again guys!

Now I'm back from other assignments and have time to deal with Dynpro again.

I have now set "cardinality" and "selection" in the source of the table to "0..n". And in the table itself, I have set "selectionMode" to "multi". But no checkboxes except for the ones mentioned earlier (the ones that were suggested just to show status or something) are shown and hence selection and delete still don't work.

I then went for one of your suggestions and created an extra column and added checkboxes to it and these boxes are shown when you run the application (so now I have two columns with boxes). But nothing happens when I click them, no response what so ever, and they don't get colored like the other ones when the row is clicked (clicked row has a red box and the others blue). Do you have to do something special in order for them to work? I thought that the selection capability was defaulted...

One of the properties for checkbox is "checked" and it has the value "false" together with a red "x". If you try to click to change this value (just tried something) you get a window with a "context viewer" in it and you are asked to chose an attribute of type boolean. I have no such in the context and when I tried to add one, I got the message that "Adding attribute not supported".

What can I do here?

Best regards

Benny

Former Member
0 Kudos

I suggest reading the table tutorial available here in SDN.

Armin

Former Member
0 Kudos

Thanks!

I think I found just the right document. Let's hope it's better than the course material...

Best regards

Benny

Answers (3)

Answers (3)

Former Member
0 Kudos

It was actually a erronous file that was the problem. When downloading it directly it worked fine.

Former Member
0 Kudos

Hi

if u havent assigned any UI Element then u wont get radio Buttons as well as check boxes.

I suppose the boxes u are mentioning beside the table are not checkboxes but are meant to know what is the row that is selected

Former Member
0 Kudos

Hi

Have u written any onAction for the Checkbox.

if not just have an onAction for the checkbox and see if u r able to get the tick mark selected.

sorry onToggle of that not onAction.

Sory i might have miss understood ur Question i thouoght u had CheckBoxes instead of RadioButtons.

With Wishes

Krishna Kanth

Message was edited by: krish kanth

Message was edited by: krish kanth