How to find the scope of data to be shown in ListView - android-listview

I have a List that contains a huge amount of data. So filtering on text change is a little bit slow. So I thought that why should i filter all the data at a time. I want to filter limited data which will be shown in ListView. Now the question is how can i know that when ListView will ask for the next 20 data from a specific index?
More explanation:
I have a ListView name list, an adapter, a List which contains 20 thousand data, and a small list(filtered). I override getView and provide data from the filtered list.
What I want to do?:
When ListView needs data (a scroll or new data event occurred), filter or search in the big list until i will get next 20 or 25 data, then set them in the filtered list and show them in listView using getView. So how could i know that when listView will need the next or previous 20 data?

You first do sort all data then pass sorted data to a adapter and use ViewHolder pattern. Do not use sort in a adapter. A adapter itself calls visible indexes data in listview.
ViewHolder links:
http://myandroidsolutions.blogspot.com/2012/07/android-listview-tutorial.html
Faster loading ListView, faster than the Viewholder method
Creating ViewHolders for ListViews with different item layouts
if you need current get visible range of listview, you can set OnScrollListener to listview and here you can get visible range and you can call notifyDataChanges method of adapter for update listview.

Related

Flutterflow and Supabase: How do I filter one ListView in flutterflow based on the selected item in a parent ListView with data supplied by Supabase?

How do I filter one ListView in flutterflow based on the selected item in a parent ListView with data supplied by Supabase?
I have two tables in Supabase (singers, songs) that are linked by the Singer ID. In Flutterflow I have a ListView that has a backend query to the Singers. I want to add another ListView within the first ListView to display a list of the songs from the songs table. How would I filter the backend query on the second ListView to filter based on the selected item in the first ListView?
I tried to filter but cannot work out how best to do this. Within the first ListView i have multiple containers. There is a separate container containing the second ListView that I am attempting to bind to the Songs table filtered by the singer in the first ListView.
Note: I am using Flutterflow rather than native Flutter
Ok i've answered my own question.
Firstly when creating the songs table in Supabase I did not create the policy. Each table in Supabase needs a policy.
Next, edit the backend query on the second ListView. Add in a filter.
For Field Name, choose Singer, the ID in the Songs table that links to the Singers table.
For Relation choose Equal To For Value Source choose From Variable Then choose ID from the Singers table.
The filter knows that a particular singer is selected from the parent ListView and filters as such.

Create ListTiles dynamically without a builder

I have a custom-filled ListView which I need to display various types of information (I know, ListView with custom-generated ListTiles is probably not the right way to go.) But I want to create some ListTiles depending on the amount of Elements I get from another List (usually 1-3 with a max of 4).
I want to display many various Items on those ListTiles and want to know how I do this the best way.
My first approach would be creating a new List tile with a for loop and fill it with the data for each entry from the other List.
Like so:
Create ListView
Create ListTiles for descriptions
Create ListTile with a checkbox to tick sth off
Get integers from json into an Array
create an additional ListTile for each of those Integers

Get selected items from a table with growing threshold SAPUI5

I'm wondering if there is a way to get all the total number of selecteditems of a table with properties growing and growingThreshold set. It seems like the call
oTable.getSelectedItems().length only works for items in the table that are on display/visible.
JSBIN Sample
getGrowingInfo().total will return all items no matter visible or not.
When growing property is set only visible items are being selected on clicking selectall.So it will return only visible items length.You may have to try for getting all items
ocheckSerialBatchJsonModel.getProperty("/results").length
If you want to get selected items you may have to add a seperate column for checkboxes and bind a property to enabled property of checkbox to json model first.Then you have to loop the entire list.
I had the same problem with sap.m.List. What I did was using the returned Listbase from the bindItems function and used the paths from getSelectedContextPaths(). Compared it with the oData and got all selected items. A little bit of a hack. Feel free to suggest something else. Didn't find anything else yet.

Grouping expand and collapse in GWT

I have multiple records which needs to be displayed as part of a search. A single result can contain multiple records associated to it. If there are multiple records I need to display the record with (+) and when clicked it further displays the list.
I would like to know what the best way is to implement ( I have checked Custom data grid ex: http://gwt.googleusercontent.com/samples/Showcase/Showcase.html#!CwCustomDataGrid but would like to use UI binder)
Once the user selects a record from the expanded list, how can we load that selected record?
Any pointer are appreciated..! ( Currently on GWT 2.2)
Widget list
Tree or maybe StackPanel seems like it would be useful here.

GWT: get backing object for row by id in table

Is there any simple way to get the object, used to render given row in CellTable, by index of the row?
I am using AsyncDataProvider, and don't want to remember lists of data objects, returned from the server. Also I am using MultiSelectionModel, so several items could be selected there and I need to track out which one was clicked last.
I know the index of last clicked row, so I need to get the object, corresponding to the row, somehow.
getVisibleItem? possibly combined with getPageStart if you're using paging and you only know the absolute index.
For your use-case, maybe you could use a customized selection model whose setSelected tracks the last change.