Infinite Scrolling of Grafana Table Plugin with lazy Loading Query - grafana

I am trying to create a custom table plugin with infinite scroll with lazy loading of query.
I have a list of 50000 Rows and query loads all the data at a time i want to make it a infinite scroll with query calling 50 rows at a time and show them Can anyone help me with it
I have tried event handling for scroll but backend doesn't hit

Related

Extracting data from a DataTable in Flutter

I've been experimenting with Flutter DataTables and everything works fine displaying a table.
However, I'm also looking to allow users to edit the table. I'm populating the table with textfields but am at a complete loss as to how to get tabular data back out of the table. Getting individual cell values isn't a problem, it's trying to get its row and column positioning that I'm unable to do.
Any suggestions?

Testing not visible rows in ui-grid with protractor

My e2e-test for ui-grid is the following:
I'm adding the new item with the name that includes timestamp, saving it to the server.
I'm checking if the item with this name has been added to the ui-grid table.
The problem is that the table can get very big and ui-grid apparently uses lazy loading and puts only the visible rows to the DOM. I found this library of helper methods for testing, but it doesn't provide anything to search for the rows which are not in visible now.
So, question, is one of the following is possible in my Protractor test?
1) can I check how many rows do I have in my ui-grid table?
2) can I search for the certain cell by text, even if the cell is not visible?
1) Can I check how many rows do I have in my ui-grid table?
As long as the row is in the DOM, you can access it. However, if it's not visible you won't be able to do any operation on it (e.g. click). To get number of table rows you can use count:
$$('table tr').count();
2) Can I search for the certain cell by text, even if the cell is not visible?
Yes, you can search for (but not interact with) the cell as long as it's in the DOM. It doesn't have to be visible. But selecting elements by their text is rather fragile, so you should try to use some other method, if possible.

How to programmatically create ListView based off SQLite query?

I have some code that allows the user to perform a search by selecting a few checkboxes. A sql query is then created based on what checkboxes are checked. (Up to 5 checkboxes)
The data is then queried against a sqlite data.
The issue is now how do i populate the data into a listview (not knowing how many columns there will be ahead of time (Could be anywhere from 1 to 5)
All the examples I"ve seen is where the listView is created and you know exactly how many colummns are going to be returned.
A previous posted suggested to query all the records and then use if statements to determine if the value is null then hide column.

How to find the scope of data to be shown in 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.

loading SQL rows into an indexed UITableView

I have about 2000 rows in a SQLite database. Each row has an integer ID and a string value. I'd like to populate them into a UITableView with an alphabetical index like the Contacts app does.
Is it feasible to achieve performance that's as good as the Contacts app without using CoreData, providing I don't need to re-implement everything that CoreData does for you (e.g. caching etc)?
I have tried to implement this using paging with 50 rows per page, and pre-load the next page in another thread when the tableview has scrolled past 25 rows. This works if the scrolling isn't very quick, but still lags when it's scrolled really quickly. I think the step to populate a temporary NSArray of 50 items is taking a long time.
Furthermore, this approach does not work very well for the index for the UITableView because the loading is done sequentially whereas the index skips. I thought about loading the first 10 rows for each index key at initialisation but again, it will be quite slow (populating an array with 260 items).
Any suggestions?
It looks like performance for fetching a few thousand rows at once should not be a big deal (You should just be able to pre-fetch them).
I would asynchronously run a SELECT on your table for whatever columns you want (like the index for reference and maybe just the string to be displayed) and throw them into an NSMutableDictionary keyed on the index and then reload the table data. The cellForRowAtIndexPath UITableViewDataSource function would use this dictionary.
If you allow users selecting a row to see details, you can then run a query for the rest of the data for that row upon selection.
Doing the initial fetch asynchronously in ViewDidLoad or ViewWillAppear will prevent the UI from locking up when the user goes to view the table and in almost all cases the table should already be visible once they actually see the table.
initial fetch(performed on a background thread, followed by the table reloading on the main thread)
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^()
{
//perform your query here
dispatch_async(dispatch_get_main_queue(), ^()
{
[self.tableView reloadData]
});
});
i am taking example of A-Z only
take 26 section in table.
there will be 26 query for fetching data
first for starting with A
second is for starting with B
third is for starting with C...... and on upto Z
in cellForRowAtIndexPath().
till the user dont scroll the table it wont fetch data for other alpha bets.
if each From A to Z contain 100 name(text).
still it wont take too much time.
hope you can get idea from here..