pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bartlett <cbartlet...@gmail.com>
Subject Re: Customized TableView
Date Sat, 19 Mar 2011 14:41:51 GMT
Eugene,

Are you aware of the MenuButton component? It sounds similar to what you
describe.
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/MenuButton.html
http://pivot.apache.org/tutorials/menu-buttons.html
http://pivot.apache.org/demos/component-explorer.html (See the Menus
section)

You might want to automatically open & close the MenuButton when the mouse
is over it if you wish to reduce the number of clicks involved in showing or
hiding a column.

If you like the idea of the mouseover menu, you could also consider just
rolling your own using Window or MenuPopup.
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/MenuPopup.html


Similar questions about hiding & showing table columns have been asked in
the past, and the suggested solutions tend to be something like this...

Add a MenuHandler to the TableView or TableViewHeader which will construct a
context menu with menu items representing all of the columns from the table.
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/MenuHandler.html
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/Component.html#setMenuHandler(org.apache.pivot.wtk.MenuHandler)
http://pivot.apache.org/tutorials/context-menus.html

The context menu might have a 'Show All' menu item, and either menu items
with checkboxes for the columns, or possibly 'Show' and 'Hide' sub menus
containing the correct columns based on the current state of the TableView.


TableViews do not support hiding columns, so when you want to hide then, you
will need to remove them from the TableView.ColumnSequence which is
available via TableView#getColumns(). You will probably need to record the
original column order so that you can put them back into the ColumnSequence
in the correct position.

Chris


On 19 March 2011 20:38, Eugene Kondrashev <eugene.kondrashev@gmail.com>wrote:

> Hi
> I have a table view displaying number of needed columns. What i want to do
> is to give user an opportunity to select shown columns.
> Let say i have col1, col2, col3. And user wants to see only col2 and col3.
>
> I need some componetnt that will show all the columns with let say
> checkboxes in appropriate state.
>
> From the top of my head i thought about ListButtons component with
> checkboxes and a label as an item. But I don't want listbuttons to hide
> every time the user checks or unchecks the item. I want to give possibility
> to dropdown the list of columns check all needed columns and hide a list.
>
> So the question is where to start from? My guess is that I need to
> implement my own itemRenderer showing chckbox with label...
>
> Perhaps there is some more suitable approach to implement that, maybe some
> default tableView behaviour that i missed?
>
> Any help appriciated.
>
> Thanks, Eugen
>

Mime
View raw message