LiveCode LessonsData GridLiveCode Data GridWorking With Data Grid TablesHow Do I Perform An Action After the User Sorts a Data Grid?

How Do I Perform An Action After the User Sorts a Data Grid?

This lesson will show you how to modify a data grid script so that you can perform an action whenever a data grid is sorted.

Add SortDataGridColumn To Data Grid Group Script

You can customize what happens when a data grid is sort by adding a SortDataGridColumn handler to your data grid group script. For more information about how SortDataGridColumn works please see this lesson: https://tinyurl.com/yd5d5766

In order to perform an action AFTER the sort has been applied you simply need to call the handler the Data Grid behavior uses to sort but NOT pass the SortDataGridColumn handler. Doing so sorts the data just like the Data Grid would and then perform any additional actions you would like.

## Place in Data Grid script.
on SortDataGridColumn pColumn
	## Call Data Grid sort routine by hand
	SortByColumn pColumn
	
	## Now data has been sorted, do whatever you need to do.
	...
	
	## DON'T PASS!
end SortDataGridColumn

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.