I have a collectionView with some elements inside it, which have a DateTime property. The graphic of each element is defined within the DataTemplate, but I would like that when there are multiple elements with the exact same DateTime property, they would be 'grouped' into a single object in the graphic
NOW:
Later:
Related
The TreeView attaches some properties to its delegate. One of them is isTreeNode. The documentation writes about isTreeNode:
required property bool isTreeNode - Is true if the delegate item represents a node in the tree. Only one
column in the view will be used to draw the tree, and therefore, only
delegate items in that column will have this property set to true. A
node in the tree should typically be indented according to its depth,
and show an indicator if hasChildren is true. Delegate items in other
columns will have this property set to false, and will show data from
the remaining columns in the model (and typically not be indented).
What is the benefit of this property? For me it looks like an alias for column == 0.
It's currently an alias for column === 0, like you say. But it makes the delegate more readable, and opens up for the possibility to rearrange columns at a later point, and improve the support for right-to-left layouts.
In Vaadin 8.1, the Grid API doc shows that we can pass a renderer as part of the column definition when calling addColumn. But I do not see any setter methods for changing the renderer.
Is there any way to change the renderer on a column in the Grid object?
Column rather than Grid
Call setRenderer on the column rather than the grid.
The column is represented by a class nested inside the grid class, Grid.Column. Pass a column ID to retrieve the particular column.
myGrid.getColumn( someColumnId )
There you call setRenderer.
myGrid.getColumn( someColumnId ).setRenderer( myRenderer ) ;
Replacing the renderer is shown in the Vaadin Framework guide, Grid page, section Column Renderers.
I have a repeating section that contains 3 contact selectors which loads different data for a given object. When I click use the "run query" option to load all of my objects, they are correctly populated for the first item. However, instead of loading all the correct values for the remaining objects, the same values are used for every other object instead of loading them individually for the given object.
Each contact selector is in its own group so that when I choose a value, the others aren't affected. However, if I have more than one object visible (by object I mean group of fields in a repeating section) the value for the corresponding field in the contact selector for the other objects gets set to the same value.
How can I make it so that these objects are treated separately?
My problem is that empty rows (if there are more rows that dataSource items then there are empty rows) look identical to rows binded to dataSource items which are empty (see the difference?).
The only way to know the difference is to hover over them with the mouse, and if they are empty there's no color change, otherwise there's the blue background of the selection..
I want to change the color or in some way hide empty rows, those that are not bound to a dataSource item.
How can I accomplish this?
You can format your DataGrid using ItemRenderer.
The itemRenderer is a display object that get the data from the data provider and display it in the grid.
Writing your own logic can help your specific data display in general. in this case, check for data on the ItemRenderer object creationComplete. it the data is null or empty - display a sign (or whatever).
See this link as reference:
http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/
Enjoy!
I'm not sure if this is exactly what you are looking for but I cut off my rows at the end of my dataprovider like this:
myGrid.rowCount = myDP.length();
This can of course be modified with some simple logic to have min, max, or if it's a data entry type of grid length()+1.
How do you make a List control wrap around to a second column (or multiple columns)? Thanks, let me know if there is a solution for this with the List control or some other Flex control.
For example, if you have one list with 42 items in it, but I want to cap the height of a list to 20 items; then instead of having one list with 42 items all the way down, I would have that list of items look like the equivalent of 3 adjacent lists: the first with 20 items, the second with 20 items, and the third with 2 items (which represent the original list of 42 items).
This question seems similar but it is in ColdFusion:
Wrapping lists into columns
Using a TileList and changing the direction variable is the best solution I have come up with.
You could use a Repeater and a simple Label based itemRenderer for the list items and avoid using a list completely. If you wrap it all up inside a custom control you can provide the same API as List so your consumers will never tell the difference.
I think you're looking for a second row, as others have noted. Either setting the wordWrap to true or using a different item renderer are the best way to get it done, but using a custom item renderer will give you more control over how the object is displayed.
I suggest creating a custom Component that wraps a variable number of Lists. This custom component can have a property named "maxListHeight". It can also have a "dataProvider" property. This custom component will produce a set of horizontally aligned lists. The number of lists produced by the custom component will be: floor(dataProvider.length/maxListHeight)+1. Where all but the last list produced will have a listHeight of maxListHeight; the last list produced will have a listHeight of: dataProvider.length % maxListHeight.
This should work but managing the addition and removal of items to the masterList should require some extra work (if it is not appended/removed from the back). This would also require instantiating multiple lists instead of just one.
The default itemRenderer for a List control is TextInput that supports only single line text. Use TextArea instead.
<mx:List itemRenderer="mx.controls.TextArea"/>
Try setting the following two properties on List:
wordWrap=true
variableRowHeight=true