cancel
Showing results for 
Search instead for 
Did you mean: 

setting table row non selectable programmatically

Former Member
0 Kudos

Hi Friends,

when I have no record, I display one populated dummy record on the screen.

when thsi is the case, user should not eb able to clcik on this dummy row.

for that, I think, need to set readonly as true and rowselectable as false.

Can some one help me with piece of code idea and where to place it.

I have some idea, that I can get it in wdmodifyView.. and there, I can access attributes of a table.

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

After the suitable call to the RFC to populate the table values, check the size of the node that is bound to the table datasource. If the size is zero, then you may add your dummy row and set the attribute (mentioned by Maksim) to WDTableSelectionMode.NONE.

Bala

Answers (2)

Answers (2)

sridhar_k2
Active Contributor
0 Kudos

Hi Nav,

Try this Solution. This one is working for me. When i have a single record the table it wont give lead selection.For your requirement, when that dummy data is there you can do row selection false.

//keep this code in wdDoModifyView()

// Table - is table Element ID

// TestNode - is binded node for the table

IWDTable table = (IWDTable)view.getElement("Table");

if(wdContext.nodeTestNode().size() > 1){

table.setRowSelectable(true);

}else{

table.setRowSelectable(false);

}

Correct me, if this is not the correct procedure.

Regards,

Sridhar

Former Member
0 Kudos

It's not the preferable solution.

Armin

Former Member
0 Kudos

hi,

For this you can create a value attribute of type boolean and bind it to

the rowSelectable property of table.

if (no record found)

{

set value attribute to false

}

else

{

set value attribute to true

}

former_member182372
Active Contributor
0 Kudos

Hi Nav,

Table UI element has property selectionMode<a href="http://help.sap.com/saphelp_nw04/helpdata/en/0e/23b3c8b0a238439f664f73a04e6332/frameset.htm">Web Dynpro Table API - IWDTable</a>. Create context attribute and bind it this property to it. Set it to WDTableSelectionMode.NONE to disable row selection or to WDTableSelectionMode.AUTO, SINGLE, MULTI to appropriate selection mode depending on your conditions. See <a href="https://media.sdn.sap.com/javadocs/NW04/SPS15/wd/com/sap/tc/webdynpro/clientserver/uielib/standard/api/WDTableSelectionMode.html">WDTableSelectionMode</a>

Best regards, Maksim Rashchysnki.

Former Member
0 Kudos

Hi Maksim, where to write teh code for that in webdynpro application? shoudl I write in wdDoModifyView method?

former_member187658
Participant
0 Kudos

Hi Nav

You have to write the code in the wdDoModifyView method. firstly, create and instance of the table Interface. and then depending upon the condition regarding the data in the table, u may set the above stated property to NONE and readOnly to true.

Thanks & regards,

Anupreet

Former Member
0 Kudos

Nav,

as Maksim (correctly) proposed to use data binding, this code may/should be written inside a controller method, most probably an event handler and <b>not</b> in method wdDoModifyView().

Armin