How to reference Data Grid pagination events

I’m presenting a database table using a Data Grid. I have custom row color formatting taking place for each row being displayed based upon the data being displayed. This works fine except that the color formatting only occurs on the first page of results in the data grid. If I click on the “>” or “>>” pagination buttons that are automatically included in the data grid view, the subsequent displays of data do not show any formatting.

Question: Is there a way to fire a method that would reformat/refresh the rows in my form when the pagination buttons from the data grid are clicked? I don’t see any way to access those pagination button clicks like I can with normal button/link components.

Thank you for your attention.

I think you can use the “form show” event (probably on the repeating panel) to fire off a function when page turns occur. Others may know of other ways.

There’s also this if you want to use regular buttons to control pagination (and fire these callbacks instead). Never used them myself, but this seems like another way to have more control when a normal button is clicked:

Thanks so much for the replies. The SHOW event seemed like a good strategy, but clicking the built-in pagination advance arrows didn’t generate any response. I tried using the SHOW event tied to both the data grid as well as the repeating panel. Neither of them triggered anything. I’m guessing SHOW only works when the component is first loaded into the page and not upon subsequent manipulations with the pagination buttons.

Hmm…ya there’s probably a way of doing it using the show event of the template rows themselves. For example, if the row knows what color it should be based on some associated data that is available, it could set that color for itself every time it is shown.

The other thing is to use css as described here:

1 Like

If the data row has the data it needs to decide what color it should be, then data binding in the row template itself would be my approach. Data binding will happen as new rows are loaded.

I’d think the show events of individual components on the row would also work, if it isn’t the entire row that changes.

2 Likes

That worked! campopianoa’s and your suggestion about affixing the logic at the RowTemplate form instead of the main form which houses the data grid turned out to apply the formatting logic through all pagination actions. Thanks!

You’re welcome! I’ve just been rewriting a project to take advantage of data grids, so have been doing a lot of data binding in row templates lately. It’s very handy.