cancel
Showing results for 
Search instead for 
Did you mean: 

Disabling row in table control

Former Member
0 Kudos

Hi All,

We are developing an application in Webdynpro using java.

Can we disable or enable a row selection on certain condition in Table Control and if yes How?

Thanks & Regards,

Nilesh

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Nilesh,

There is no way to disable <b>selection</b> of particular row(s). It is possible only to disable selection alltogether for whole table. Or to disable cell editors (as other suggesting).

VS

Former Member
0 Kudos

Hi,

Thanks all of you.

Yes, Actually I'm looking at enabling or disabling entire row for selection in Table Control.

From your answer it seems it is not possible thanks.

Regards,

Nilesh.

Former Member
0 Kudos

Hi Nilesh

Its <b>possible</b> to enable or disable a entire row in a table control.

  • First add a attribute 'RowEnabled' of type boolean in the table control's source node.

  • Then for 'Enabled' Property of the table columns of the table, assign the attribute 'RowEnabled' of the source node.

  • Then using index, change the value of 'RowEnabled' to true or false. The particular row with the index will get enabled or disabled.

Any doubt i ll be happy to resolve ;>)

Regards

Rakesh.

Former Member
0 Kudos

Rakesh,

How your advise is related to <b>row selection</b>???

VS

Former Member
0 Kudos

Hi Nilesh

You can enable/disable a row on selection of a row. In Event handling method onActionOnleadSelection, get index by node().getLeadSelection() method. By the index change the RowEnabled attribute.

In this example, Itemx node contains many attributes including RowEnabled attribute of type boolean.

 public void onActionOnleadSelection(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
//@@begin onActionOnleadSelection(ServerEvent)

IWDNodeElement currentnode =  wdContext.currentItemxElement();
int index = currentnode.node().getLeadSelection();

wdContext.nodeItemx().getItemxElementAt (index).setRow_Enabled(false);

}

Regards

Rakesh ;>)

Former Member
0 Kudos

Yes, but this was not the question.

As already stated correctly, the <b>selection</b> itself cannot be disabled per row, only per table.

Armin

Former Member
0 Kudos

Having a look at this code, I recall that NW04s (probably latest NW04 SPs like SP16) has selectionChangeBehavior property on Table control.

If you are using version that supports this property, you may do the following:

1. Set selectionChangeBehavior=manual. This way row is not selected automatically.

2. Add onLeadSelect action to table

3. Create mapping of "nodeElement" parameter to parameter "row" of type IWDNodeElement

4. In action handler check row.index(). If index is selectable, then execute wdContext.node<TableSource>().setLeadSelection( row.index() ) otherwise return.

This way user will be unable to select certain rows. This works only with single selection (not multiple).

Up to certain extent you may try the same even without selectionChangeBehavior property. Just always save lead selection to controller instance variable and try to restore previous selection in onLeadSelect action handler.

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

Hi Nilesh

This has been already discussed. See the forum link. It works fine.

Hope it helps ;>)

Rakesh

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Check Armin post to disable the particlular row cell editor based on condition using calculated attribute.

Regards,

Vijayakhanna Raman

Former Member
0 Kudos

Hi

See the Thread

Kind Regards