Make Font Bold for selectedRow on Table component

Dear Inductive Team,

We had a customer requirement where we need to make Font bold for selectedRow on Table Component. We see that Table has Selected Font color, Selected Background Color as properties for Table Component. However, they are particular about Font Bold as well.

We tried with following code on Table Mouse Pressed Event for a solution:

[code]# Get required variables.
vTable = event.source
vSelectedRow = vTable.selectedRow

Remove Bold from all rows.

for col in range(vTable.data.columnCount):
for row in range(vTable.data.rowCount):
vVal = str(vTable.data.getValueAt(row, col))
vVal = vVal.strip(’’)
vVal = vVal.strip(’
’)
vTable.setValue(row, col, vVal)

Make Selected Row Font Bold.

for row in range(vTable.data.columnCount):
vValue = str(vTable.data.getValueAt(vSelectedRow, row))
vValue = ‘’ + vValue + ‘
vTable.setValue(vSelectedRow, row, vValue)[/code]

However, As you can see from code - It will work only for String (Because you are appending ) Datatype columns. Not work for other datatypes (Integer, Date etc.).

How we can resolve this requirement ?

You are right, the tags only work for strings. However, there is a workaround. You can add another column to your dataset that is an integer. Hide the column so it is not visible to the user. In the event handlers, when the selected row changes you can set the integer column to 1 when selected and 0 when not selected. In the table customizer, you can put font mappings on each column based on the new integer column. So when the integer column is 1 you make the fonts bold and when 0 make them regular.

Thank you Travis.

Let us put one more issue. The Dataset for Table component will change based on selection (in our case based on Radio Button selection). There are few columns which are common, few columns which are separate.
Example: Dataset1 Columns = Col1, Col2, Col3, Hide (Column for Font bold)
Dataset2 = Col1, Col3, Col6, Col7, Hide (Column for Font bold)

In this case, How we can set Font Map List ?

Just make sure a row for each possible column exists in the “Column Attributes” dataset property. If the row with the same column name exists in there it will use that configuration. You can put the same translation lists on each column. You can add rows manually to the column attributes dataset.

Thank you Travis.

We got our required solution.

Welcome to the forum, IFTIKHAR.

Did you notice that this thread was last updated twelve years ago in 2012?

I think you should delete your post and create a new thread.

4 Likes