Re: EuGTK:Filtering ListViews
- Posted by irv Sep 03, 2019
- 1129 views
Thanks to info from some of the sources linked above, I was able to code a pretty simple demo by creating three models:
- first is where the raw data is loaded and stored. I called it stored.
- the second model, a GtkTreeModelFilter, named filtered, is created from the stored model,
- the third, a GtkTreeModelSort takes its input from the filtered model. Call it sorted.
This way, you can sort and filter, or filter and sort, or only one or the other without them interfering with each other. Sorting is automatic, you just change the sort column. Filtering is almost as easy, just a simple comparison.
See https://openeuphoria.org/pastey/320.wc
Note: if you require one or more columns to be sorted as, say, dollar amounts, you write a custom sort routine for that column. See https://openeuphoria.org/pastey/321.wc You can, if necessary, set up a different custom sort for as many columns as need one. Otherwise, the default build-in sorting routine will be called.