GWT implementing-- Sophistication of CellTable behavior, flexibility of CellList look - gwt

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.

Related

How can I add a custom column menu tab in ag-grid?

Is there a way to add a custom column menu tab with my own favourite icon which on click would render my custom react component?
something like
myColDef.menuTabs: ['generalMenuTab', 'filterMenuTab', 'myCustomMenuTab']
FYI I'm using v12.0.2
What you're after can't be done I'm afraid. The grid supports React components in all sorts of ways (renderers, editors, filters etc), but not via the column menu.
I've updated the docs page to remove the gibberish issue - it'll be fixed properly in the next release, thanks for highlighting this.
This would be helpful to have. In particular for us, we'd like to filter based off row properties, and not row values. Creating our own tab to filter by cell colors that we have assigned with our own set of labels would be useful.
I agree that it would be a nice feature to have. Apparently, there's no quick out-of-the-box solution to do it. The only workaround I see is to implement your own custom Header component which would display any buttons your want.
There you can put a button to open your own custom menu, which you can implement as any regular UI component. It also means you'll need to manually implement all standard menu options that Ag-Grid provides out of the box if you need them.

GWT - adding pseudo Anchor

Is there any way in GWT to get a pseudo anchor ??????
I just want to have TextCell or textColumn in a Celltable with underlined text onclick of which a dialog box opens. This is a simple requirement and i donno why i am still not able to figure out how to do this. If it was to be written in HTML this is hardly 2 seconds job.
And i do not want to use Hyperlink or Anchor which causes a page refresh which seems unnecessary for my requirement.
This looks more complex than learning Japanese to me.
ClickableTextCell is probably what you are looking for. You can quickly override it's render method to give the cell content the appearance you require, if the standard appearance is not suitable.
When the cell is clicked, the value updater of the Column that hosts the cell will be called.

how to add a disclosure panel to a cellTable column in GWT

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.

Disable Selection for GWT CellList

I'm trying to build a website similar to kayak.com, at least with respect to how it displays and filters results. I'm using GWT and have built a Composite widget which uses a CellList to display the results.
I'm not happy with how the cells are selectable. I've tried setting the SelectionModel of the CellList to an instance of NoSelectionModel, but that doesn't seem to work. Really, I just want to display some text and a few hyperlinks in each cell and only give the user visual feedback (change the mouse pointer, etc.) when the mouse is over a hyperlink.
See if this works for you:
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/2327336e09ab29d1
Use
cellList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
to disable selection on a CellList.

What are some SWT datagrids/tables?

I need to be able to display some data in Eclipse in a grid/table control... I need things like paging, multiple column sorting, column choosing, etc. There is an SWT Table and the Nebula project has a grid in alpha.
Does what I need exist? 3rd party maybe? Doesn't have to be free, we can pay for the functionality.
I haven't seen those features implemented in a reusable widget that I can think of, they are more application-level features.
Paging:
If you were to use the JFace-type viewers (SWT Table or Nebula Grid both support this style of MVC architecture, as do some others mentioned in this question), it should be possible to implement paging in the content provider, just by setting some custom offset into your dataset and then refreshing the grid.
Multiple Column Sorting:
You can do this, it just needs an implementation of the correct table sorting interface. You get passed two rows to compare, and you can compare whichever columns you like in the sorting algorithm. Again though, the interface for actually choosing which columns to sort is down to you.
Column Choosing:
This requires a grid control with cell selection. Nebula is one, SWT Table isn't. If cell selection is available, this is just a matter of catching the correct selection event (clicking on a header probably) and iterating over your rows to select the correct cells.
There is also a new "rising star" on the widget sky called "nattable 2.0". It is an opensource project and the development team is very responsive. You should take a look at nattable.org ...
You could use the facilities of table presentation offered by the BIRT plugin, that is if you are really advance table layout needs.
(source: theserverside.com)
(otherwise the classic SWT TableViewer offers already some of the feature you are after
(source: richclient2.eu) )