I'm following the example about DragAndDropCellTable in GWTQuery example where the drop target is a CellList. What i need to do is Drag a CellTable row and Drop it in another CellTable. Is it possible? Any Pointers? I'm using GWT2.4
Related
I am new to eclipse rcp and i was creating a table and a tree for drag and drop.
Tree will have list of nodes which can be drag and drop in table particular cell.
Drag and Drop does work fine but i am not able to drop the node text in particular cell of a table. Always it update the first column of the table.
Please if anyone have any idea of this.
I want to remove a style from a previously selected row of a gwt DataGrid when clicked on a new row.
Im able to do it by redrawing the grid, is it possible to do it without redrawing the grid.
You can do that with gwtquery, just capture the event and use gquery to select the element in the dom you want to modify using css3 selectors.
If you put some code with the place where you want to capture the action, and the dom structure of your grid, I could help with the snippet.
I have a GWT CellTable - it's a pretty simple table with just a single string column.
What I'd like to do is drag rows of this table to a drop target (actually another table). I've been trying to figure out how to attach a draggable event as described at ~23:00 of this video.
To which CellTable element can I set the draggable flag to TRUE.
I haven't gotten this far yet, but I'm sure I'll soon face a similar issue in setting the drop handler on the target table.
If someone could post an example or point me in the right direction, I'd be grateful.
Take a look at GwtQuery drag and drop plugin. It offers drag and drop support for CellWidget
Documentation : http://code.google.com/p/gwtquery-plugins/wiki/DragAndDropPluginForGWTDeveloppers
Example wit CellTable : http://gwtquery-plugins.googlecode.com/svn/trunk/droppable/demo/CellTableSample/CellTableSample.html
With a GWT CellTable its possible to add different columns that handle the click event in different ways.
For example lets say we have 3 columns:
an Avatar Image (ImageCell),
a name (TextCell),
checkbox (Checkbox
cell).
Then image adding these events:
When the ImageCell is clicked we can open a popup.
When the checkbox is clicked select the row.
When the name is clicked open the users profile.
With a CellTable it's straight forward to accomplish this.
However what if we wanted a view that doesn't look like a table. The CellTable is tied to a HTML Table for its implementation. Why not allow for a general HTML implementation of the CellTable (behavioral) API.
Using a CellList we can accomplish any view. But the API isn't as sophisticated as the CellTable. It would be cool if we could add something analogs to CellTable 'Columns' to a CellList.
Is there anyway to accomplish this with the current Cell Widgets? I might have over looked something.
Thanks!
I think there are two solutions:
Use a CellTable and style it so that it looks like a CellList. This should be quite straightforward and possible. However you would have to play with the CSS styles a little bit. Best approach would be to use Firebug to change the styles on the fly and see the results instantly
Use a CellList and create a custom cell which renders and handles events for your use case (Avatar, Name and Checkbox). This is more involved but there is a tutorial on the GWT page.
I would probably try to go with solution 2 because it also teaches you how to create custom Cells which might come in handy later on.
Update:
As Thomas suggested in the comments you can use a CompositeCell which wraps 3 different cells. That's probably the easiest way to implement it.
I have a cellTable with 5-6 columns. I want to put a plus icon in each row on clicking of which will display the details maybe in a disclosure panel. I have been looking around for a while now and I cannot find any information on how to achieve this. Could someone point me in the right direction?
i suspect i probably have to add a cellTree to the column? how do i go about this?
Thank you for your response in advance.
There is work in progress to allow expandable rows in CellTable among other features (maybe GWT 2.3). You can see more details here:
http://groups.google.com/group/google-web-toolkit-contributors/browse_thread/thread/b4a8a6e3c98ac061#
If that is not enough or you can not wait untill it is released I can think of two ways to achieve it:
As you said, using a CellTree.
Creating a custom cell that stores
state (open/close). Depending on the
state the cell will render
differently. In same way it is
similar to how EditTextCell works, in
"edit" state it renders an input
field while in "normal" state it renders
simple text.
I'm trying to do that too ... I managed to mimic that functionality toying with the html and a custom cell class that allows clickable pictures.
It is working for normal content such as text but if you'd like to get an asynchronous data to show in the expended line, I don't know how to do it ... (I'm trying to do exactly that).
Also, it doesn't look good because the columns don't align well ...
So what I've done is:
- create a custom cell class to display a picture (right pointing triangle, looking like the triangle in the disclosure panel)
In the click event get the HTML code of the selected row and copy it. Replace the content of the row (all cells) in the table with only one cell with its colspan set to number of columns. In the cell, add a table with first line the copied row and second line the content to display as expanded.
Get the image to sink an event for closing. In event, reset the original row that we copied.
I hope it helps.