Basic Customization > User Interface Customization > Presenting Information in the UI > Constructing and Rendering a Table Using the JSP Framework > Customization Points > Configuring Non-Selectable Rows
  
Configuring Non-Selectable Rows
Non selectable row based on an existing visible column
Non-selectable rows can be set depending upon a column that has a Boolean value.
An example:
TableConfig table = factory.newTableConfig ();

//a column that is suppose to hold a boolean
ColumnConfig col1= factory.newColumnConfig (“aBooleanColumn”, false);

table.setNonSelectableColumn (col1);
Configuring Non selectable rows based on a boolean attribute value available in the backing object
The data utility com.ptc.core.components.factory.dataUtilities.DefaultBooleanValueDataUtility is provided out of the box for configuring non selectable rows. This data utility is mapped to column id “com.ptc.core.components.descriptor.DescriptorConstants.ColumnIdentifiers.NON_SELECTABLE_COLUMN”. There are two ways to set this data utility for a column in a table:
Use NON_SELECTABLE_COL as the column id
Create a column with an Id as “com.ptc.core.components.descriptor.DescriptorConstants.ColumnIdentifiers.NON_SELECTABLE_COLUMN”. Set the attribute as the need.
An example:
TableConfig table = factory.newTableConfig ();
ColumnConfig col = factory.newColumnConfig (NON_SELECTABLE_COLUMN, false);
col.setNeed (<Attribute>); // Specify the attribute which will decide the row is
selectable or not.
col.setDataStoreOnly (true); // this will make your Column hidden
table.addComponent (col);
table.setNonSelectableColumn (col);
Setting datautility id to NON_SELECTABLE_COLUMN
Create a column with any Id, set the attribute as the need and set the Datautility Id as “com.ptc.core.components.descriptor.DescriptorConstants.ColumnIdentifiers.NON_SELECTABLE_COLUMN”.
An example:
TableConfig table = factory.newTableConfig ();
ColumnConfig col = factory.newColumnConfig(<columnId>, false);
col.setNeed (<Attribute>); // Specify the attribute which will decide the row is
selectable or not.
((JcaColumnConfig)col)setDataUtilityId (NON_SELECTABLE_COLUMN);
col.setDataStoreOnly (true); // this will make your Column hidden
table.addComponent (col);
table.setNonSelectableColumn (col);
Non selectable row based on a custom data utility
Create and register a custom data utility for the column to be used as a non-selectable column.
Create a custom data utility
A custom data utility for controlling non selectable rows should extend “com.ptc.core.components.factory.dataUtilities.AbstractBooleanValueDataUtility”.
The method getBooleanAttributeValue() method can be overridden with custom logic:
An example:
package com.customPkg;
import com.ptc.core.components.factory.dataUtilities.
AbstractBooleanValueDataUtility;

public class TestCustomDataUtility extends AbstractNonSelectableRowDataUtility {

public boolean getBooleanAttributeValue (String component_id, Object datum,
ModelContext mc) throws
WTException {
/* this method will return true if the row is not selectable */
}
}
Register the custom data utility:
Configure the newly created data utility against the column id:
<Service name="com.ptc.core.components.descriptor.DataUtility">
<Option serviceClass="com.customPkg.TestCustomDataUtility "
requestor="java.lang.Object" selector="col1” cardinality="duplicate"/>
</Service>
Non-selected rows are displayed as follows: