cancel
Showing results for 
Search instead for 
Did you mean: 

Enabling selected rows in a table

Former Member
0 Kudos

Hi all,

I need to enable certain rows of a table based on a condition. I have implemented it in the following way.

IPrivateRailShipNomRetNomView.ILi_NominationsElement nominationnode = null;

IPrivateRailShipNomRetNomView.IEnableElement enabled_node =null;

int rows = wdContext.nodeZl_Wrailshipnom_Ret_Nomination_Input().nodeOutput2().nodeLi_Nominations().size();

for(int i=0;i<rows;i++)

{

nominationnode = wdContext.nodeLi_Nominations().getLi_NominationsElementAt(i);

enabled_node = nominationnode.nodeEnable().getEnableElementAt(0);

String update = nominationnode.getUpdate();

wdComponentAPI.getMessageManager().reportSuccess(update);

if (update.equalsIgnoreCase("X"))

{

enabled_node.setEnableAttribute(true);

continue;

}

enabled_node.setEnableAttribute(true);

}

My node structure is as follows:

---Node1 (Model Node)

-


Output (Model Node)

-


Li_Nominations (Model Node)

-


Enable (Value Node)

-


EnableAttribute (Value Attribute)

But it is not working. All the rows are getting enabled. What could be the problem? Can anyone help me out?

Thanks in advance.

Regards,

Reena

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Let "Rows" be the context (model) node used as the table's data source.

Add a value node "State" (cardinality=1:1, selection=1:1, singleton=<b>false </b>) inside "Rows".

Add an attribute "RowEnabled", type "boolean" inside "State".

Now each(!) node element of "Rows" (i.e. each table row) has a storage location for its enabled-state, namely the attribute "RowEnabled" in node "State". Because "State" is a non-singleton node, every "Rows"-element has its own copy of this node and the contained attribute.

Armin

Former Member
0 Kudos

Hi Armin,

Thanks for the reply.

I got your point.

I have set the cardinality, selection and singleton values as mentioned by you. Still I am unable to change the enable state of selected rows. All the rows are enabled. I want to make some rows disabled.

Any other pointers?

Thanks in advance,

Reena

Former Member
0 Kudos

Ok, now that you know how to store the state for each row, you only have to find the right point in time when this state has to be updated. This might be inside an event handler of the view controller.

Is the problem still open?

Armin

Former Member
0 Kudos

Hi Armin,

The problem is solved now.

The problem was at the Selection value. I had not set it to 1..1

Now its working fine.

Thanks a lot.

Reena

Former Member
0 Kudos

Hello,

This may have been answered in various threads - but I am unable to find corresponding layout changes that would actually disable the row. Which IWDTable property should the "Enabled" boolean be assigned to - "enabled" or "rowSelectable"? Right now, after implementing the code above, the entire table gets disabled, whether I set the boolean to "enabled" or "rowSelectable". Would highly appreciate a step-by-step guidance.

Thanks in advance,

Siva.

Former Member
0 Kudos

Set the "enabled" or "readOnly" property of the <b>table cell editor</b> e.g. a InputField.

Armin

Former Member
0 Kudos

Thanks for the quick response, Armin.

In my case,

a. I do not have any input fields in the table, it is a display only (but selectable) table - so I need to be able to disable the entire row instead of a specific field

b. Also, will this way of setting the boolean work? I am not sure if the way in which I access the state/boolean is correct.

for (int x = 0; x < wdContext.nodeRequests().size(); x++) {

if (x == 1 || x == 3 || x == 5) { //some business condition

wdContext

.nodeRequests()

<b>.getRequestsElementAt(x)

.currentStateElement()

.setRowEnabled(false)</b>;

}

}

Answers (0)