Flex datagrid control with expanding rows - apache-flex

I'm looking for a DataGrid with expandable rows implementation in Flex. I don't want to use Advanced DataGrid control because it's too slow and too complex.
The desired behavior is like this: when you click a row, a panel opens between the rows with some details and the rest of the rows are moved down, and when you click again the panel is closed and the rows are back to normal. If you click the other row, the one that was expanded collapses and the row you clicked is expanded.

You'll probably need to use a custom ItemEditor that responds to clicks and expands itself.
The variableRowHeight property may need to be set to true as well.

The behavior you are describing sounds an awful lot like an Accordion component, though that doesn't quite sound like what you are looking for. Another approach would be to use a List component with a custom itemRenderer that is expanded when in the selected (clicked) state, and collapsed when not selected.

We extended Flex Datagrid component and used custom item renderer for this. We actually expand one cell and resize it to cover all other cells in the same row. While this may be not the easiest solution it works and the Datagrid is very fast.

Related

How can I create a draganddrop wrapper inside a table row, that can represent the whole row

When I use treetable in Vaadin, it is working fine drag and drop the whole row when click the left and right blank ereas. but that is not user friendly, I wanna create a draggable layout inside the row, let's say the 1st component of the each row, that when clicking it, the whole row is selected and can be draged and dropped to reorder.
The thing is I can create a vertical layout with wrapper doing that, but drag mode is only for its component or the wrapper itself, and when doing the drag action, it doesn't actually showing the whole row is moving, which may confuse the clients. What can I do to make it looking like I am dragging the whole row, similar with the one you drag the blank area of each row? Thanks.
I'm afraid there currently is no way for adding a wrapper that would extend the entire row instead of just one cell. To do this you'd need to extend the client-side implementation of Table (VScrollTable) and this is not something I would recommend as it is quite complex.
I do think that what you describe should be possible in core Vaadin (without using drag & drop wrappers), so could you please file a ticket at dev.vaadin.com? And please attach a small application showing the problem to make it easier for us to see the problem and fix it.
Anyways, in order for you to get it working today I'd suggest that you change your UI design a bit and for example borrow drag handles from iOS. By this I mean that you could add an icon that suggests "draggable" as a background-image in the first cell (or in the row header cell of each row) that encourages the user to grab the row there, where it is "empty" and dragging works. This way the user might not be too confused if dragging only works reliably in some parts of the rows.

Flex TileList itemrenderer + scroll = HELL

I'm going insane over this issue. Basically, I have a TileList with a custom item renderer that has a TextInput in it. Let's say that the list can show 4 items at once, if there are 5 items and I edit the text on the first one, the fifth will be edited also. In general if an item is out of view, it will be change when I edit one that is showing.
Also, I had overriden the TileList class to expose the rendererArray property (so that I could access the texts on each renderer) but it will only return the renderers which are displayed.
Any help is appreciated. I need to know how to override this weird behaviour with itemrenderers that aren't currently displayed. Thanks.
Ok, if anyone runs into a similar issue, here is what you need to do:
First of all, avoid trying to iterate through the itemrenderers like I did. If you need a TextInput or another control on your TileList, make sure that these controls are bound to a property on your data object, otherwise off-screen items will have incorrect values since their itemrenderers will be recycled from the items that left the screen when you scrolled.
If you think it through, any requirement can be solved by iterating through the dataprovider instead of the itemrenderers.
Also, if you try to expose the rendererArray property like I did, notice that you will only be able to iterate through the itemrenderers that are currently displayed, since those that would belong to the items that are off-screen will not be created yet.
I hope this wasn't too confusing..

Adding drag & drop to a datagrid column in flex

I have two datagrid components and I would like to drag one column from one component to the other. I have been trying several methods but I couldnt acomplish that.
Can anybody help me with this?
What you want to do is to disable a column on the first datagrid and enable it on the second. You have to listen to DRAG_START events, find what field is the target column, and hide it on the first datagrid when the drag succeeds. Then you use a symetrical approach for the second datagrid...
I guess you will have to create a custom drag proxy visual component if you want it to be visually coherent.
Good luck =)

Advanced DataGrid Flex 3 - ItemRenderer and Tree display

I am using Advanced DataGrid of Flex 3 with hierarchical data. The itemRenderer is a TextInput which accepts numbers. When I enter data into the given field and click the corresponding expand tree icon for the row, I want the amount entered in tree node should get cascaded to its child rows. But I found the nature of advanced DataGrid erroneous.
When I enter data and click on tree icon, the data is not populated in child windows unless i wont take the focus out from the editing control.
I tried using itemEditEnd, itemFocusOut etc but of no use. I have to explicitly click on any of the other columns and then expand tree.
Am I making any mistake anywhere?
I found solution to my problem, its bit ugly but it works. I had to register two events for textinput as follows
addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, allocateAmount);
addEventListener(FocusEvent.KEY_FOCUS_CHANGE, allocateAmount);
and then by using IViewCursor I could able to update data.

ASP:ListBox | Multi Select | Keep selected values when selecting a new one

1) Have a listbox with 3 values out of 5 selected
2) When I click to select another value without holding CTRL button, it will unselect over values
How to make it keep other selected values if new value is selected?
This is going to sound like a snide answer, but I don't mean it that way. I just like to look for the simple solutions rather than the complicated onces.
The easiest way to get a control to have the behavior you want is to use a control that has the behavior that you want, rather than modifying the behavior of an existing control.
That said, if you want a list of items where a user can select a bunch of items off the list, and don't want to have to rely on them holding control, you're using the wrong tool for the job.
Use a CheckBoxList instead of a ListBox. If you want it to be scrollable, then set it in a div of a specific height, and set the style of the div to "overflow: scroll".
If you still want to use a ListBox you should use javascript and for each click event fired, you should check if the clicked element is selected/unselected and act accordingly. It's a little bit tricky but at least it is a solution for your problem.

Resources