HZNM.COM
welcome to my space
X
Search:  
 HOME   Show/Hide table column
Show/Hide table column
Published by: mike 2009-01-09
Welcome to:hznm.com

  • I'm trying to replace the context menu of the table with a left-click menu. Menu is working fine but when i try to hide and show a column of the table i get some issues:
    1. i must call recalculate() on the table to make the column disappear after i set it hidden
    2. column doesn't come back when i set it not hidden even if i call recalculate() or in my app code the column comes back but without header (not reproduced in this example)

    this is a piece of code i use to test and shwo the result

    package com.zensistemi.test.client;

    import java.util.ArrayList;
    import java.util.List;
    import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
    import com.extjs.gxt.ui.client.Style.SelectionMode;
    import com.extjs.gxt.ui.client.event.ComponentEvent;
    import com.extjs.gxt.ui.client.event.SelectionListener;
    import com.extjs.gxt.ui.client.widget.ContentPanel;
    import com.extjs.gxt.ui.client.widget.Viewport;
    import com.extjs.gxt.ui.client.widget.button.Button;
    Джумла! България - Помощен Сървър 2 (версия 1.0) - Table - Contact Category::
    Table Headings: Show/Hide the Table headings (Name, Position, Email, Phone, and Fax). Position Column: Show/Hide the column displaying the contacts
    http://help2.joomla-bg.com/index2.php?option=com_content&t14&pop=1&page=0&Itemid=31
    HOME
    import com.extjs.gxt.ui.client.widget.layout.FitLayout;
    import com.extjs.gxt.ui.client.widget.table.Table;
    import com.extjs.gxt.ui.client.widget.table.TableColumn;
    import com.extjs.gxt.ui.client.widget.table.TableColumnMo del;
    import com.extjs.gxt.ui.client.widget.table.TableItem;
    import com.extjs.gxt.ui.client.widget.toolbar.AdapterTool Item;
    import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.ui.RootPanel;

    public class TestModule implements EntryPoint {

    protected Table tbl = null;

    public void onModuleLoad() {

    Viewport viewport = new Viewport();
    viewport.setLayout(new FitLayout());

    ContentPanel cp = new ContentPanel(new FitLayout());
    cp.setHeaderVisible(false);
    cp.setBorders(false);

    ToolBar tb = new ToolBar();
    cp.setTopComponent(tb);

    Button b1 = new Button("Hide");
    How to: Add a Visibility Toggle to an Item (Reporting Services)::
    Add a visibility toggle when you want to enable a user to interactively show or hide report items or, for a table or matrix, rows and columns associated with a
    http://msdn.microsoft.com/en-us/library/ms156456.aspx
    HOME
    Prince: CSS Properties::
    table | prince-footnote | prince-column show | hide. float table-column-span. number | attr(colspan) table-layout. auto | fixed. table-row-span
    http://princexml.com/doc/6.0/properties/
    HOME
    b1.addSelectionListener(new SelectionListener() {

    @Override
    public void componentSelected(ComponentEvent ce) {
    //hide column
    tbl.getColumn("Symbol").setHidden(true);
    tbl.recalculate();
    }

    });
    AdapterToolItem atiB1 = new AdapterToolItem(b1);

    Button b2 = new Button("Show");
    b2.addSelectionListener(new SelectionListener() {

    @Override
    public void componentSelected(ComponentEvent ce) {
    //show column
    tbl.getColumn("Symbol").setHidden(false);
    tbl.recalculate();
    }

    });
    AdapterToolItem atiB2 = new AdapterToolItem(b2);

    tb.add(atiB1);
    tb.add(atiB2);

    List columns = new ArrayList();

    TableColumn col = new TableColumn("Company", 180);
    col.setMinWidth(75);
    col.setMaxWidth(300);
    columns.add(col);

    col = new TableColumn("Symbol", 75);
    columns.add(col);

    col = new TableColumn("Last", 75);
    col.setMaxWidth(100);
    col.setAlignment(HorizontalAlignment.RIGHT);
    columns.add(col);

    col = new TableColumn("Change", 75);
    col.setAlignment(HorizontalAlignment.RIGHT);
    columns.add(col);

    col = new TableColumn("Last Updated", 100);
    col.setAlignment(HorizontalAlignment.RIGHT);
    columns.add(col);

    TableColumnModel cm = new TableColumnModel(columns);

    tbl = new Table(cm);
    tbl.setSelectionMode(SelectionMode.MULTI);
    tbl.setHorizontalScroll(true);

    for (int i = 0; i < 50; i++) {
    Object values = new Object[5];
    values[0] = i;
    values[1] = i;
    values[2] = i;
    values[3] = i;
    values[4] = i;

    TableItem item = new TableItem(values);
    tbl.add(item);
    }

    cp.add(tbl);
    viewport.add(cp);
    RootPanel.get().add(viewport);
    }

    }
    any idea what i'm doing wrong ?


  • Excellent!


  • You can hide / show a column via the TableColumn:

    tbl.getColumnModel().getColumn(1).setHidden(true); Make sure to grab the latest code as there was a bug with TableView.





  • How much does getting a small tattoo on your hip/stomach hurt?
    Do anyone else have an itchy anus? ?

    You are looking at:hznm.com's Show/Hide table column, click hznm.com to home
  • treats for baby leopard geckos
  • can i introduce a new leopard gecko to my old 1
  • for next years pow wow
  • do russian tortoises eat tiny spiders less than the size of a cenimeter
  • what should i do about my angry ball python
  • my african rock python has a serious scale problem
  • will a turtle lose shell kinda like shedding scales when i cleaned the tank i had some shell in the bottom
  • my bearded dragon laid a clutch of eggs
  • why does my fire bellied toad wiggle his butt
  • can bahama anoles and green anoles mate
  • if i bought a 15 foot retic python and it got a hold of my hand could it swallow it as far as my shoulder
  • what should i feed my hermit crabs
  • frogs in my fire escape
  • is it normal that my turtle is shedding its skin
  •  
  • my male rabbit keeps biting the neck of the female should i split them up we got them as a pair
  • how do i bring up the heat in my anole viv
  • what would be the best defense if a python has got hold of you
  • info on possibly getting a horse
  • how long does it take for a baby turtle to start growing
  • is my leo big for his her age
  • help need info asap
  • is it ok to to put a juvenile chinese water dragon in a big cage
  • good filter for turtles
  • about how much does it cost to buy everything for a bearded dragon
  • juvenile chinese water dragon wont eat 1 5 months old
  • what kinds of bugs aren 039 t good to feed leos
  • reptiles and growth
  •  Homepage | Add to favorites | Contact us | Exchange links | LOGIN | Site map | 
    Copyright© 2008 hznm.com        Site made:CFZ