MUI DataGrid ColumnDef: the row is not available on the valueOptions prop of the column definition - material-ui

I am using a DataGridPro component with different columns.
One one the columns is defined like this:
This issue is that I am trying to understand why the row is not available in the valueOptions prop of the column definition.
I would like to be able to populate the choices based on a list that is available on the row in another field.
But I get this error when I try to read the row:
Can you please help? The grid is populated with lots of rows coming from an api fetch.
Every other column is working fine accept this one.
Thank you.

I discovered that it was my bad. My column object was used twice with different parameters and so, yes, the row was not available for the second case.

Related

How to relate a column to the row rather than the other way in anylogic

I have created a database in anylogic. Previously, I have related the information in the row to the columnn, i.e. there is a component in the row, and its properties are in the columns, and have put this in a function. Now I want to make the component the column and the properties, but don't know how to make it all relate. Below is the code I've written for the former:
site = selectFrom(parameters) .where(parameters.box_number.eq(boxNumber)) .where(parameters.site.eq(site)) .firstResult(parameters.site);
So box_number is the component and site is one of the properties. With this method, site is a column, but I want it to be a row.
You should use the SELECT WHERE SQL syntax, see https://help.anylogic.com/index.jsp?topic=%2Fcom.anylogic.help%2Fhtml%2Fconnectivity%2Fquerying.html&resultof=%22%73%65%6c%65%63%74%22%20%22%77%68%65%72%65%22%20
You can filter and load data in any format. Also, best use the database query wizard to help:

AG-Grid: Add and remove columns in column groups while maintaining the state of other columns

I have a table built with AG Grid which needs to display different columns depending on the type of data we give it. This is proving slightly difficult, as I can't find a proper interface in AG Grid which allows you setup new columns in existing column groups, and without blowing up user-driven changes (hidden columns, resizing, pinning, etc).
The biggest issue is that I can't figure out how to access column group definitions.
gridOptions.api.getAllColumns()
This function from aggrid does not directly provide column groups, just the child columns. Looping through the columns via this function, they have a parent property, but that does not include the coldef for the column group, which means there isn't even really a way to reconstruct the coldef based on the data you get from it (also, the parent property is private in typescript).
Here is a rough plunker, modified from one of the ag grid documentation examples which illustrates it
https://plnkr.co/edit/C8TrwlkFDg5O5V1RJkng?p=preview
I did try having all the columns present in the table at all times, and hiding them programmatically based on the incoming data, however that creates several issues with the default column show/hide functionality (you can manually show the invalid columns). Using the initial coldefs won't work too well either, since that will discard any modifications the user has made to the columns.
Is there anyone out there who can point me in the right direction?

sap.m.Table removeColumn does not delete the corresponding items

If I remove one Column using a sap.m.Table from a standard view the corresponding items are still available. The problem here is that the ordering is wrong after I delete a column here.
Lets say I want to delete the "Historie"-Column, the corresponding items are still available. How can I delete one column with the items of one column here?
The problem here looks like that:
As you can see in the picture below I have deleted some columns and also the "Historie"-Column. The corresponding items are still available.
How to solve this and delete the matching items here using sap.m.Table?
I tried to remove the Columns by removeColumn(oCol) from the API: sap.m.Table
I think this is a bug with sap.m.Table.
For your problem, you can use the visible property of column to hide the column from view. Though it will not remove the column from the table.
var oTable = this.byId('idTable');
var oDeleteColumn = oTable.getColumns()[0]; //fetch the column you want to hide
oDeleteColumn.setVisible(false);
removeColumn() removes the column only from the table's <column> aggregation, but not from the data.
If it is an option for you, than use Table Personalization:
Table personalization can be used to modify the display and settings
of a table.
It is a UI pattern that is used to change one or more of the following
attributes:
Visibility of columns
Order of columns
Sorting
Grouping
Filtering
Sample

How to access a cell value when the column has been defined with ag-grid expression/value getters?

If the ag-grid column definition has been defined with a value getter or if an expression has been defined for a cell the value gets displayed fine on the grid. However I was not able to find a way to access a value in a given cell if the cell is using cell expression/value getters. Was trying to access the data through api.forEachLeafNode, but it seems even the in memory model does not have this data. The only way I found was to export the data as CSV and then parse it using getDataAsCsv(params).
Is exporting the data the only way to access value of a column in a grid with a value getter?
Why does the In Memory model not have this data to access?
valueGetter is used during the rendering stage, it only computes when needed to render the cell. if the cell is never rendered (eg row is below what is currently visible) then the valueGetter is never executed. the result is never stored in the model, it is only passed to the cellRenderer.
so what you need to do to get the result of valueGetter is use api.getValue(colKey,rowNode)
colKey is the id of your column. this can be the column itself (if you got the column from the grid column api) or the column id. the column id is what you will probably want to use. the column id is assigned to the column in the following order 1) the colDef.colId if exists 2) the colDef.field if exists 3) generated if both colId and field are missing. so if you are using a valueGetter, you are probably not providing a field, so just provide a colId.
rowNode is the row in question. this is what you get when you use api.forEachLeafNode.
the api.getValue() method is pretty recent, i know it's in version 7 - so if missing just make sure you are v7 or above.

Have a jcombobox filter a jtable

following this tutorial http://www.netbeans.org/kb/docs/java/gui-db-custom.html#enhancements
it shows how to use a textbox to filter out the master table. Could anyone instruct me on how to do a similiar thing but use a dropdown to test against a specific column?
(ie a dropdown of countries, to filter by the country column?
thanks
depending on what the source is for the dropdown.
i assume the dropdown isn't used as part of the Jtable itself, but merely shows a list of unique data coming from one column of data?
in that case, you could get the Jtable's datamodel, and then walk through all the cells in the particular column, putting them in a hashmap with the string as the key. that way you have a list of (unfiltered) unique strings to use as the datamodel for the dropdownbox.
You could attach a model listener to the talbedatamodel to know when your list has to be updated as well.