cancel
Showing results for 
Search instead for 
Did you mean: 

Checkbox selection in table

Former Member
0 Kudos

Hi Web Dynpro masrers,

I have a quick question. I have a table with a checkbox. The problem is that when I check/uncheck not only the selected row is checked/unchecked but all the rows from the table. How can I fix this?

I also want when I open the view with this table some rows to be checked and some unchecked (whether some condition, like element's key or something else) and when I check/uncheck to save the changes.

Thanks in advance,

Kostadin

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

I just made it. The problem was so stupid, I've changed one of the attribute name with the other After I fixed this it works fine.

Thanks all for the quick response! You really helped me a lot and save me lots of hours!

Former Member
0 Kudos

Well, putting the attribute in the table source node was pretty good move Now I can check/uncheck eache checkboxes without changing all of them. Now I'm trying to set some rows to be checked depending on their key, but have no success by the moment, don't know why. I tried sever ways but haven't made it by now. I guess it should not be so hard to be done, so if someone has any idea for this can share otherwise I'll set the question status to "answered".

Thanks all for help!

Former Member
0 Kudos

Please post your context structure.

Armin

Former Member
0 Kudos

Ok, I'll try what Armin suggested. Hope it will work. I'll let you know the result of the try

Former Member
0 Kudos

So I've made a new column for the checkbox. The contex for the checkbox is:

ColCheckBox

-


checkbox

checkbox is boolean, not calculated (I tried also calculated, the result was worse then not calculated)

The node ColCheckBox is with selection cardinality 0..n and singleton = true (although I'm not sure what exactly this is for)

I haven't made any implementation for onActionToggleCheckBox cause I want first to make it show some rows checked and the rest unchecked wheter some condition. The problem is that all the rows are always checked/unchecked together. Which I guess is not a big surprise cause I still haven't made the loop and setting some checked/unchecked rows. How exactly should I make this, cause I tried several times with no success?

Thanks,

Kostadin

Former Member
0 Kudos

Set cardinality=1:1, selection=1:1, singleton=false for node ColCheckBox and put it <b>under</b> the data source node of the table.

To access the check box value at table row 5, use code like


I<TableDataSource>Element row = wdContext.node<TableDataSource>().get<TableDataSource>ElementAt(5);
boolean value = row.currentColCheckBox().getCheckBox();

Armin

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

Do as Armin Suggested.

<b>Your checkbox attribute is part of your Table Datasource Node.</b>

Regards

Abhimanyu L

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

In your Context Node, take another attribute ReadOnly of boolean type

Now bind your check box readonly property to this attribute.

Now go to onSelect Event of the table.

loop at the Context Node Elements

and set readOnly attribute to true only if it is not the selected row

Hope it is clear.

Regards

Abhimanyu L

Former Member
0 Kudos

I forgot to say that I've read several other threads about checkbox in table before I ask for help, including this one.

Former Member
0 Kudos

Ok, Use a context structure like this

Table (Value node, bound to <i>dataSource</i> property of table UI)
--Other attribute
--Other attribute
--Other attribute
--Checked (Value attribute, type <i>boolean</i>, bound to <i>checked</i> property of checkbox)

For conditional checking of the checkboxes, based on the condition use a code like:

wdContext.nodeTable().currentTableElement().setChecked(true);

In the meantime can you share your context structure?

Regards,

Satyajit.

Former Member
0 Kudos

Hi,

i think you want to create a Table column as check Boxes.

what you can do is create a value node for this checkBox column inside the context Root node from where you are binding your Table column value and then create a value attribute inside this value node and bind this value attribute from the checkBox column.

Thanks,

Mithileshwar

Former Member
0 Kudos

Hi,

Please go through thread.

Regards,

Satyajit.