Closed tonosama-atlacatl closed 9 years ago
The List implementation is demonstrated that we can have any customized List act as data source of grid, base on this idea, async data loading, data view are not necessary porting from original (slickgrid) version. Would you like try a new List implementation that may fit this scenario?
Well, I can see the use of FilteredList where you keep two internal lists, one which is the original and the other a smaller version which is in view. It just seems like you already have all the mechanisms to do filtering with the filteredList, I'll hate to just create a new list that replicates ~80% of it, just to give me a look into the view list. I'm open to suggestions, I wanted to check with you before attempting something on slick_util.dart...
All I need is to be able to keep the row selection after applying a filter to a filteredList, and in order for me to do this based on your checkbox example, I have to query the list for an item's index. I can simply add the item function to both lists? or we can settle that if a filter is present, _viewList is always targeted. I'm not sure how extensive this might change things.
OK, i see what you need, hmm...it is general and very useful in my imagination. I think we can add a optional function parameter to setKeyword() to change filter behavior
would the optional parameter expose the viewList?
K, I solved the issue by creating another version of "FilteredList" that exposes a function to locate: _viewList.indexOf
I see that this function is based on the source list (_srcList). But, this creates a problem if we're using a filteredList as data and we want to retain the checkbox selections after applying a filter and wanting to sort a column.
Could we condition this just like get length? get length => _filter.length==0 ? _srcList.length : _viewList.length; So, if there is no filter, only deal with the original _srcList, if there is one, then _viewList.
Or, we add separate function that deal with _viewList only.
The problem I'm seeing is that I started with 300 rows, then I applied a filter that yields 10 rows, but when I try to select any row and then sort it with a column, the indexOf(item) always returns me the old index... like 287, when I'm only seeing 10 rows on the grid.