Hi folks, A new week brings a new learning curve(!) I've now created my first data grid and I'm looking to set conditional filters on which rows are displayed, but can't seem to find what I need in the documentation. Is there a smart/simple function somewhere to help manage data grid row filtering or do I need to build-out a script from scratch, iterating through each line of the array behind the data grid and recreating the dgData property?
Before I graduated to the multi-dimensional arrays and data grids, I had an 'items' list and a separate 'items to exclude' preference list. I simply looped through the 'items to exclude' list, applying a filtering to the items list. Things seem to be a little more complicated with arrays and data grids, so I'd welcome any advice. I was hoping to maybe using a contextual menu action in the data grid to 'hide this row', together with buttons beneath the data grid to 'view hidden rows' (and therefore update a row filter preferences list) and 'reveal all hidden rows' (to bypass or cancel the preferences list).
I'd much appreciate it if anyone would care to share some pearls of wisdom.
Best,
Keith..
Data Grid - how to hide or filter rows?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Contact:
Re: Data Grid - how to hide or filter rows?
Hi Keith,
There is no built-in filtering for the data grid. You will need to manage the filtering on your own by updating the dgData property.
There is no built-in filtering for the data grid. You will need to manage the filtering on your own by updating the dgData property.
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
Re: Data Grid - how to hide or filter rows?
Hi Trevor, Thanks for the clarification.
It's surprising that there is no built-in support for what I would imagine to be an obvious, common requirement - still, good to know that I won't be reinventing the wheel as I try to sort it for my needs!
Best,
Keith..
It's surprising that there is no built-in support for what I would imagine to be an obvious, common requirement - still, good to know that I won't be reinventing the wheel as I try to sort it for my needs!
Best,
Keith..
-
- VIP Livecode Opensource Backer
- Posts: 163
- Joined: Tue Jan 26, 2010 10:15 pm
- Contact:
Re: Data Grid - how to hide or filter rows?
Hi Clarkey,Clarkey wrote:Hi folks, A new week brings a new learning curve(!) I've now created my first data grid and I'm looking to set conditional filters on which rows are displayed, but can't seem to find what I need in the documentation. Is there a smart/simple function somewhere to help manage data grid row filtering or do I need to build-out a script from scratch, iterating through each line of the array behind the data grid and recreating the dgData property?
Before I graduated to the multi-dimensional arrays and data grids, I had an 'items' list and a separate 'items to exclude' preference list. I simply looped through the 'items to exclude' list, applying a filtering to the items list. Things seem to be a little more complicated with arrays and data grids, so I'd welcome any advice. I was hoping to maybe using a contextual menu action in the data grid to 'hide this row', together with buttons beneath the data grid to 'view hidden rows' (and therefore update a row filter preferences list) and 'reveal all hidden rows' (to bypass or cancel the preferences list).
I'd much appreciate it if anyone would care to share some pearls of wisdom.
Best,
Keith..
I know two techniques to filter the content of a datagrid:
1) You have a database:
- Execute a request to retrieve data in the database
- Set the DG to empty
- Replace the content of the DG in the database
2) You have no database:
You can draw two datagrids.
The first contains all your records and remains behind the scene (you can hide it or put it somewhere in a card in your project)
The second contains the result of your search in the first DG.
I'm using this technique to draw dynamical trees in a datagrid.
But it requires that you develop yourself a search engine and a way to copy the filter result of DG in another DG.
So it is possible filtering rows in a DG. For doing that I'm using a personal library.
TheSlug
http://www.aslugontheroad.com - Tutorials, demo stacks and plugins for LiveCode
Data Grid Helper - An intuitive interface for building LiveCode's Data Grids
Excel Library- Extends the LiveCode language for controlling MS Excel
http://www.aslugontheroad.com - Tutorials, demo stacks and plugins for LiveCode
Data Grid Helper - An intuitive interface for building LiveCode's Data Grids
Excel Library- Extends the LiveCode language for controlling MS Excel
Re: Data Grid - how to hide or filter rows?
Hi Zryip,
Thanks for sharing the ideas of setting the visible data grid to be the filtered view of a different data set.
I was slowly stumbling towards a variant of your option (2). My raw data is stored in multidimensional arrays within stack custom properties, which are then mapped into the data grid's underlying array. Given Trevor's clarification that I'd need to refresh dgData properties following an external filter action, I was looking to divert this direct mapping through some kind of preferences list with inbuilt filtering control to provide a reduced dataset for the main data grid.
This preferences list control would not (necessarily) need to be as sophisticated as a data grid but it would need to control a multidimensional array with filtering and descriptive data - because my source data is dynamic and so I need to support change management of the preferences list as the source data evolves (hence this post regarding ListMagic capabilities http://forums.runrev.com/phpBB2/viewtop ... f=8&t=5534)
The path forward seem to be becoming a lot clearer - thanks!
Keith..
Thanks for sharing the ideas of setting the visible data grid to be the filtered view of a different data set.
I was slowly stumbling towards a variant of your option (2). My raw data is stored in multidimensional arrays within stack custom properties, which are then mapped into the data grid's underlying array. Given Trevor's clarification that I'd need to refresh dgData properties following an external filter action, I was looking to divert this direct mapping through some kind of preferences list with inbuilt filtering control to provide a reduced dataset for the main data grid.
This preferences list control would not (necessarily) need to be as sophisticated as a data grid but it would need to control a multidimensional array with filtering and descriptive data - because my source data is dynamic and so I need to support change management of the preferences list as the source data evolves (hence this post regarding ListMagic capabilities http://forums.runrev.com/phpBB2/viewtop ... f=8&t=5534)
The path forward seem to be becoming a lot clearer - thanks!
Keith..