Dev-Owl / advanced_datatable

Advanced Datatable uses the Fultter PaginatedDataTable Widget and adds a few more functions to it

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question regarding row index calculation

opened this issue · comments

Hi
I´m a flutter beginner and struggle a little bit with your enhanced widget because I would connect it to a sqllite table with provider support.

From debugging point of view, paging is working in following method, total amount of elements is corrent and I´m always receiving current paged elements here.

@override Future<RemoteDataSourceDetails<Nutrition>> getNextPage( NextPageRequest pageRequest)

Can you please explain me, where following index is increased internally?
If my page limit are 5 elements, all pages are using index from 0 to 4....I would expect index 5 on my second page here

@override DataRow? getRow(int index) { return getDataRow(selectedRow, selectedIds, index); }

Thanks a lot for any hints :-)

Ah it looks like index is correct but elements have to be from current page

Hi traubch,

Not 100% sure if I got you, but the index is always local to the page, keep in mind that the state that is shown also only knows the current page.
If you can keep all data for all pages, and it works fine you can also switch to a normal data table/list, the idea for the control was born since I have views with 100,000 or more records that we can't load in one view.

Of course, it's also a valid approach to do this for smaller data sizes. If done right, you reduce the load on the client and backend as you only work with small datasets in one go. For a mobile app, backend and frontend could be on the same device (like in your example).

Please don't hesitate to send in an example of using the control alongside of SQLite it might help the next person to enjoy Flutter :)

In case you need further help, just open this ticket/create another one.

Cheers,

Christian