I am trying to display a grid with nested rows. My data has a children property with objects similar or almost exactly as the parent one.
I have tried giving some of my columns a cellRenderer property of 'group'.
I have been using getNodeChildDetails, but it seems like this method got deprecated and the new way of doing this is to specify a property on every row called path, which I find to be a pretty weird and ugly approach.
getNodeChildDetails mentioned above does not support any changes inside the row, therefore it is not of good use for me.
is there a method replacement for getNodeChildDetails that would have the same functionality?
All I want to do is group by row some data on whether it has a children property or not.
Related
We are currently using this prop in ag-grid.
onDisplayedColumnsChanged={event => event.api.sizeColumnsToFit()}
It is helpful for preventing whitespace from showing up when we hide a column, as well as keeps horizontal scrolling to a minimum when we unhide a column. We also use it for similar reasons when grouping on a particular column(s).
Unfortunately, it prevents us from using other features of Ag-Grid, such as selecting the option to resize a column to fit its contents. It also prevents columns that have been manually resized from keeping their size when they are moved somewhere else on the grid.
Is there any way to check for whether a column is being added/removed/grouped? the event object provided by the onDisplayedColumnsChanged prop only exposes the columnApi, api, and type properties. I haven't found anything useful in those so far.
I've considered creating a useEffect that will sizeColumnsToFit when the gridApi changes, but I believe I hit the same issue there with not having any useful properties to trigger the effect.
You can tell AG Grid columns to ignore sizeColumnsToFit() by setting the property suppressSizeToFit to true:
https://www.ag-grid.com/javascript-data-grid/column-sizing/#size-columns-to-fit
You can set the property on-the-fly by listening to one of the column events where auto-sizing should be disabled:
https://www.ag-grid.com/javascript-data-grid/grid-events/#reference-columns
Is it possible to have an extjs (classic) propertygrid with multiple columns for multiple data sources? We want a component where we can manage the pricelists/product matrix. Of course, we could do it with a table but this looks strange since you might only have two rows then and is far off from how the end result would look like. We are right now on extjs 6.x with the classic toolkit. How would you implement such a component based on the grid component since every column is expected to have one datatype but for a propertygrid every row column can be different in type?
I created an example of the grid you need. I overridу some celleditor methods and the headercontainer(used in propertygrid) constructor (this should not affect the other components), and I also defined a new component, the columns (additionalColumns) of which can be supplement in the same way as in the grid.
With help verticalCellTypes you can specify the same data types for the column or row
I wrote my own sub-class, for some selection stuff and paging etc. But those all worked with the renderer(), which required them to return a string.
This worked fine, I created some image-tags and returned those.
But how does this class work in detail?
I want a sub-class which displays a chart in a cell, which should technically be no problem, but the renderer() doesn't seem the right place for it, since it only works for strings.
Does the Class get instantiated for every row? or is it really just one instance for a column, which methods get called for every row with the needed data and the instances don't hold any state about the rows?
The renderer() mechanism is actually implemented in Ext.grid.column.Column, for which there is one per column.
As you have mentioned, the renderer() function returns a string, which could be an HTML string (which could be rather complex - have a look at the templates used by ExtJs for the standard columns). But you cannot return a component (chart).
To the best of my knowledge (based on my own understanding and replies to similar questions), ExtJs does not offer a straight-forward way to render components within grid cells. If you really think about it - you are asking a grid for much more than its intended role. It was designed to present records per raw, with the addition of simple user interaction facilities, like checkboxes.
But what you are really asking for is more of a way to layout charts, for which problem i suggest you look into the Table layout.
Alternatively you should be able to render a chart into a dom element, which will be defined in your own custom column template. But I will consider this to be an involved task.
I understand the syntax but not how really to use it. It's clear in many basic scenarios but as soon as it get's a little bit advanced I start getting a headache.
For example there are many different views but often not clear wich one to use. Also should you use always just one or mix and match. Do you use the view as your itemssource for ItemsControls?
I'm gonna give a scenario. I have items from a database that I need to show info about in a app and also allow to edit and add new. The items form a hierarchy and the models are of different types. So the top level have children and they then have children.
I could show it in a TreeView or some itemscontrol. Problem here is I tend to bind to the children property of the root elements wich returns a List of chilren. Now the children aren't really inside a view, like I can't call editview.addnew() or filter the children straight away. Question is how do I ensure the children are also in a view and their children and so on. Should the model return a view, should I create a seperate view for each children type or even for each parent?
Another thing is if I'm allowing editing should I put the Collections straight into a IEditableCollectionView or wrap it in ICollectionView first (why is that better)?
Is there a good guide to using views that isn't just pure basics?
I've got a strongly typed dset, w/two datatables: Parent and Child, w/a relation linking them in the way you'd expect (e.g. parent-has-many-children).
On my Child Detail form, I show lots of info on the current child, w/binding calls like so:
me.txtBirthDate.DataBindings.add(New Windows.Forms.Binding("Text", MyDataset, "Child.Birthdate"))
But I would also like to show some info on the child's parent--say, the parent's name. I have tried:
me.txtParentName.DataBindings.add(New Windows.Forms.Binding("Text", MyDataset, "Child.Parent.Name"))
and
me.txtParentName.DataBindings.add(New Windows.Forms.Binding("Text", MyDataset, "Parent.Name"))
But these both result in a blank text box.
I can of course put the parent properties directly on the Child DataTable & fill them w/the results of a join between the underlying db tables, but I'd like to avoid that if it's possible (my real app involves just a few Parents each w/many many Children & I'd like not to be moving so much unnecessary data).
Is that possible?
Many thanks!
-Roy
I usually use a BindingSource between the DataSet and the controls. When using this approach, if I have controls that I want to bind to a related row from a different table, I create a new BindingSource, which points at the related row (his DataSource property is the original BindingSource, his DataMember is the parent table), and then bind the other controls to the 2nd BindingSource.
I usually do it all in the designer view, which just creates those BindingSource objects as I go along.
Hope that helps.