React Ag Grid GetColumnState - flex is always null - ag-grid

I am trying to save the state of cloumns in a AG grid table.
I have found this page in the AG grid documentation
https://www.ag-grid.com/react-data-grid/column-state/#width-and-flex
In this documentation it is written that when getColumnState() is called, both width and flex are returned.
However in my case and also in the examples on the documentation flex is always null.
How do I get the flex values of the columns instead of the width values?
#######
UPDATE
I found new infos in the docs. https://www.ag-grid.com/archive/27.1.0/react-data-grid/column-sizing/
If you manually resize a column with flex either via the API or by
dragging the resize handle, flex will automatically be disabled for
that column.
However my problem is still not solved.
Is it possible to recalculated the flex values of the columns or is there any other approach?
#######

Related

How to auto adjust content control width to table column width in word using office js APIs?

I have custom word add-in, which inserts content control with numbers and currency symbols as text into word document at the cursor position.
Requirement is if content control is getting added inside a table, as a table cell, then width of content control should match with table column width.
Current behavior:
current behavior
Expected behavior:
expected behavior
Questions:
Is there any office JS API or out of the box Word feature to auto adjust content control width to match with table column width?
If not, is there any way to calculate width of both content control and table column programmatically and get number of spaces to be added? This algorithm should be generic so that it would work for all font families and font sizes.
Thanks for reporting the issue. It's definitely not right behavior and it has been put on our backlog 6336725. We will let you know when there is update. Thanks!

Whats the difference between DataTables widget and Tables Widget in Flutter?

Im going to create an excel like application in Flutter where the user can input a quantity to one of the cells and the app automatically calculate its values based on quantity.
Shall i use DataTables or Tables widget?
Both accept widgets as cell content like TextField, Slider or just Text. Anywhere there are some differences:
Feature
Table
DataTable
Checkbox column
no
showCheckBoxColumn
Set column width
columnWidth
no
Set row height
no
dataRowHeight
Sortable
no
integrated
If a cell with a no this does not mean, its not possible. The feature is just
not directly supported by the widget. In all cases sizes will computed according to Flutters rendering engine: constraints go down, sizes go up.
Anybody please feel free to add more content to above comparison.

Adjust column width in Nattable - show complete column name when selected

I need to display complete column header name, when column is selected, it means increase column width. And reset width when column is deselected. I did not find example in nattable_examples.exe. Is there some built in feature?
No there is no built-in feature that would support automatic increase/decrease of column widths on selection. You will need to implement some selection listener and then do an auto-resize on the selected column by using the AutoResizeColumnsCommand.
But I don't think we have an event on deselect, so I am not sure how you want to reduce the column width again.

How to save column order and the width of the re-sized columns after changing the size of columns in NAT table into the prefernce

How to save Column order and width after changing their position and size ?
re-sized column width should be persisted and used in the subsequent sessions (and also considered during export/import preferences usecase)
any change in the column position should be persisted and used in the
subsequent sessions (and also considered during export/import
preferences usecase)
Q1. How can I get the column width of the nattable after changing the width by dragging/double click event ?
- I want this with original column position even after the column is not in the original order.
Q2. How can I get the column order, after re-order using drag and drop?
Answer to Q1:
Ask the layers, they have getWidth() and getColumnWidthByPosition(int) methods
Answer to Q2:
Typically you will need to check the ColumnReorderLayer directly.
But if you want to store and load NatTable states, you should have a look at the persistence mechanism provided by NatTable. I wrote an article about this and it is even documented on the NatTable website.

How to create Spreadsheet in Flutter

How to create spreadhseet like Widget in Flutter (only for displaying data).
Currenly I have used Datatable but it does not support 1. fixed header 2. scrollable body.
I want following features:
The headers shoule be fixed.
the body should be scrollable (in both axes)
Currently my Datatable is inside a column > Expanded > SingleChildScrollView(horizontal) > SingleChildScrollView (vertical) > DataTable. Although I am able to scroll the complete Table in both the directions but 1. not simultaneously (i.e. it scrolls either horizontally or vertically), 2. Headers should not scroll, when scrolled vertically.
How can I achieve this ?
It seems that you need scroll controller that allows two or more scroll views to be in sync. In his case, you can use linked_scroll_controller plugin.
You can follow the example in this blog post for a step by step tutorial on how to achieve this.
Sample taken from the blog, check the complete source code here:
Here is an another package for this purpose: syncfusion_flutter_datagrid.
It has several features:
Editing - Allows users to edit cell values.
Sorting - Sort one or more columns in the ascending or descending order.
Stacked headers - Show unbound header rows.
Paging - Load data in segments.
Freeze Panes - Freeze the rows and columns when scrolling the grid.
And more, details in document
However, scrolling simultaneously is something different feature in this case.
You can try InteractiveViewer, but this not recommended in this case. Because both widgets, InteractiveViewer and DataTable, are very powerful widget that may build some conflict.