Row Header Styling - text aligment

Tags: #<Tag:0x00007efc648d8a08>

Hi,

I revisited the topic Row Header Styling - text alignment, which is now closed.

I successfully implemented the afterGetRowHeader callback, and managed to apply custom styles to the headers.

The problem I am facing is that the recommended approach will change all the headers, whereas I only need to apply conditional styles to the headers of certain rows.

The only way I could do that is by having access to the table instance (as other callbacks do, e.g. afterChange), so I could query certain custom properties of the row and then to apply the conditional styles.

However, the afterGetRowHeader callback only provides the row number and the TH header element. With that alone, I don’t have any further information about the table itself (e.g. how many rows the table has).

Ideally, I should be able to get access to the data source of the table when this callback is fired.

Is there any workaround for this?

This is how I register the hook:

objectAssign(this.tableOpts, {
...
afterGetRowHeader: afterSalesGetRowHeaderCallback
});

And this is how I implemented it:

protected static afterGetRowHeaderCallback(row: number, TH: Element) {
...
}

Best regards.

Nicolas

Hi @developers

Please correct me if I’m wrong. You’d like to change a certain row header based on the number of rows in the table. If so then here is demo for adding a custom header for the last row in the table http://jsfiddle.net/p6cborms/ it works well when you delete or add new rows or move them.

Thanks Aleksandra for such quick response,

The row count was just an example.

I would like to do something more specific like:

if (this.hot.storedData[<myRowId>].myCustomRowProperty()) {
// Do something here
}

Regards.

N

We just realized we are dealing with concrete issues in our implementation.

It would be too time consuming to post them here, and they may not be of any use for other programmers.

In a nutshell, your jsfiddle is the answer we were looking for.

Best regards and thanks once again.

Nicolas

I’m glad that I could help.

Feel free to ask if you need any other guidance.

1 Like