bosskmk / pluto_grid

PlutoGrid is a dataGrid for flutter that can be controlled by the keyboard on desktop and web. Of course, it works well on Android and IOS.

Home Page:https://pluto.weblaze.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Help] How to set height for the table based on the list

kunalprabhu21 opened this issue · comments

how to set height for the table based on the list

@kunalprabhu21
There is no function to set the height of the table according to the rows.
You have to set the height manually, such as with Sizedbox or Container.

Ok thanks for your reply..will figure something out

Ok thanks for your reply..will figure something out

I think I have done the same thing so you may figure it out by below code snippets.

SizedBox(
height: AppConstants.customTableTopHeaderHeight /Top Header/ +
AppConstants
.customBottomPaginationHeight /Bottom Pagination Widget if data is within shown range/ +
(AppConstants
.customTableRowAndDividerHeight /Row's height + divider/ *
_getRowsPerPageCount()) +
2 /Extra Height to manage inside scroll/,
child: PlutoGrid(

In above I have created _getRowsPerPageCount() which returns the no of rows by calculating between currently selected row count [10, 50, 100, 500, 1000] and the rows you have loaded by state manager.

You can set var _rowsPerPageCount directly instead of _getRowsPerPageCount(), if you not using pagination. But if yes, then you also need to update your page size and Page also like below whenever you select any of these [10, 50, 100, 500, 1000]

void _handleChangeHeight() {
_plutoGridStateManager!.setPageSize(_getRowsPerPageCount());
_plutoGridStateManager!.setPage(1);
Future.delayed(const Duration(milliseconds: 300)).then((value) {
if (mounted) {
setState(() {});
}
});
}

Change according to your need, hope this will help you.

This issue is stale because it has been open for 30 days with no activity.

This issue was closed because it has been inactive for 14 days since being marked as stale.