[OutSystems Data Grid] Issue with Grid Event "OnSortChange"
data-grid-reactive
Reactive icon
Forge component by Platform Maintenance
Application Type
Reactive

Hello,

I'm trying to implement a custom sorting option using the Grid Event "OnSortChange" that is available in the Data Grid Component.

I'm getting an error.

Here is how its configured. I have set the Grid widget id to the data grid id.

Am I using this event properly? All I'm using it for is to display the Active Sorts so that I can properly refresh the data when a user sorts a column.

I looked through the documentation but found no references to OnSortChange. Data Grid Documentation.


I had a try, and the error is not there, and the event goes off, when i place the onsortchange block after the grid.

See attached your oml revised.  On screen1 i placed it right behind the block, that seems to be working, on screen2, the only change i made is moving it right in front of the grid, and there it is not working and gets the error.

Dorine

DataGridSortTestRevised.oml

Hello @Adam Holland 

Thank you for reaching out.

Could you please share a sample with that use case so that we can try to help?

Cheers,
GM

@Gonçalo Martins 

I created a test app and it's also displaying the same error. Simply adding a blank grid, Setting the Grid Id, Grid Data fetch and a Blank Client action produces the error. I have not added the server refresh because I'm trying to determine the format the sort is in for conversion.

I don't have any external references or external data being refreshed in this example.


Looking to do Server side sorting just like I am able to do Server Side Pagination. 

The SQL Statement we have, uses the page index and max records to limit the number of records.

(Our max records is limited to 200 records or less based on user preference)

The Default sorting in this component only sorts the records returned, not the whole database. (So sort is limited to 200 max Records)

We need to apply the sorting with these constraints and use the pagination to list the rest with the sorting applied

The SortForSQL in the image below will be in this format (Name, or Name DESC. Room, or Room DESC...etc)

DataGridSortTest.oml

Hi Adam,

I have no experience with this webblock, but I suspect the error is related to the order in which things load on the screen.  Try moving the OnSortChange Block after the Grid itself, maybe that changes the order of loading.

I don't know if this is even possible with this block, never used it.

Dorine

I moved the Event to after the data grid but it still has the issue.

I pasted the Outsystems Data grid script into the console and ran the "GetGridById" function manually.

The function returned the data grid.

I'm thinking the event is being initialized before the data grid is initialized on the page.

Here is the error in the console.


I had a try, and the error is not there, and the event goes off, when i place the onsortchange block after the grid.

See attached your oml revised.  On screen1 i placed it right behind the block, that seems to be working, on screen2, the only change i made is moving it right in front of the grid, and there it is not working and gets the error.

Dorine

DataGridSortTestRevised.oml

That seems to have worked in the Main application.  Thank you.

Setting it before the grid will produce the error as well as setting it inside the Data Grid

Here is the new Widget Tree For Reference to other users.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.