Make a column visible false?

Hi ppl
How do I make column visible false? Tried all kind things without any luck?

Hi all,
hmmm...
To remove a Column you only have to save the removed column into a list. When you want to see the column again, only add it to the TableColumnModel.
For example:
public YourTable extends JTable{
  private Hashmap deletedColumns;
  public void removeColumn(Object columnIdentifier){
    TableColumnModel columnModel = getColumnModel();
    int index = columnModel.getColumnIndex(columnIdentifier);
    TableColumn column = columnModel.getColumn(index);
    if(deletedColumns == null)
      deletedColumns = new Hashtable();
    deletedColumns.put(columnIdentifier, column );
    columnModel.removeColumn(column);
  public void addColumn(Object columnIdentifier){
    TableColumnModel columnModel = getColumnModel();
    TableColumn column = (TableColumn )deletedColumns.remove(columnIdentifier);
    if(column != null)
      columnModel.addColumn(column);
}NOTE: I didnt compile the code, but this is the way to do it.
Take care, because the default models takes String as identifiers for the headers. That isnt right, because all Objects wich have a implemetation of the "toString" will be returned as a String...

Similar Messages

  • How to make all columns visible in an interactive report by default

    Hello All,
    I have an interactive report with the first column is visible and the rest are hidden by default. Is there any way that i can make them all visible by default so the users do not have to go into actions to display them in report?
    Thank you
    Sezer

    Login as developer > run the interactive report > actions > select all columns you want
    Now got to actions > save > default > primary > apply
    http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21674/ir_using.htm#CHDFDFJA

  • AddColumn() make removed column visible again. Pls help. :)

    I have a JTable which I need to remove and add column.
    // declaration of table and tablemodel
    DefaultTableModel tableMod = new DefaultTableModel (data, col);
    // data is Object[][] type, col is String[] type
    myTable = new JTable(defaultTableModel );
    DefaultTableColumnModel columnMod = (DefaultTableColumnModel)myTable.getColumnModel();
    My remove column code is :
    columnMod.removeColumn(columnMod.getColumn(1));
    My add column code is :
    tableMod.addColumn("three");
    My problem is : say my table has 2 columns initially
    "one" "two"
    after removeColumn(), the column will disappear from the JTable. like this
    "one"
    but when I addColumn() later, the removed column will appear again. like this
    "one" "two" "three"
    I think the problem is DefaultTableColumnModel is used to removeColumn but DefaultTableModel is used to addColumn, resulted in some kind of discrepancy, how to go about this? I know I can do perform addColumn() and removeColumn() on JTable, something like :
    remove -
    myTable.removeColumn(myTable.getColumnModel().getColumn( myTable.getSelectedColumn() ) );
    add -
    addedColumn = new TableColumn()
    myTable.addColumn(addedColumn);
    But when I do this addedColumn has a modelIndex of 0 , and anychanges to addedColumn will be reflected on first column(because modelIndex is 0) as well...which is what I don't want.
    Hope I'm making sense, any help appreciated.

    Ok, so heres my gripe with actually removing a column from a JTable : A JTable rebuilds its entire column model when it gets certain events (e.g. if the table model calls fireTableStructureChanged). This makes it unreliable to remove columns from the table by the method you give (though im not saying it cant be done, feel free to pursue that avenue if you like). Im just saying a more reliable way to do it is to have you own table model that knows exactly what the columns are to be in the JTable at any time. This way if the JTable rebuilds it column model it wont remake a column you removed.
    So heres the basics of removing and adding a column by changing the table model :
    A table model (derived from AbstractTableModel) needs to have three functions:
    public int getRowCount();
    public int getColumnCount();
    public Object getValueAt(int row, int column);So if you're at a time when you only want one column, getColumnCount() should return 1. If you want to say add two columns, then have getColumnCount() return 3. You would then also need to change what gets returned by getValueAt() so that it tells what is in the three columns appropriately. Also, whenever the number of columns is changed, you would need to fireTableStructureChanged(), to let the table know to rebuild it column model, with or without the columns you want added/removed.
    That is exactly what is done in the other post. I don't mean to not directly answer your question, i just don't think that removing and adding columns like that is how JTable is meant to be used, in MVC architechure. I dont really have any information about adding and removing columns because I've never even attempted to change a table that way. All i can say to that is that you have to figure out how JTable works, which I would try putting tons of System.out() calls telling me exactly what the column model looks like after certain changes(it indexes, etc..).
    Well i hope this helps in some small way...
    Josh

  • Link Button.Visible = false refresh problem.

    Hi,
    Who knows why what to do when you make your LinkButton.Visible = false and some pixels around the arrow remain on screen.  Its very ugly.
    I did try a Form.Refresh() but a Refresh() never word for me anywhere so
    I'm looking for some kind of trick to completely hide the arrow !
    Any idea ?

    Hi Marc
    Try this out
    oForm.Freeze(True)
    LinkButton.Visible = false
    oForm.Freeze(False)
    oForm.refresh()
    Hope it helps
    Regards
    Aris

  • How to make keyfigure columns in-/visible dynamically in a web template

    Hello,
    I want to implement a button into my web template, making a first key figure column invisible, a second key figure column visible. Clicking the button again shall make the first column visible, the second invisible.
    How can I achieve this?
    1) Using the filter_pane_item it is possible to choose the key figure structure and the a key figure for the analysis_item. Can this action be encoded behind a button?
    If this would be clear, create a first button to choose the first key figure, then a second button to choose the second key figure. Finally enhance both buttons making one another visible and we are done.
    2) An idea was to define two query views, one with the first key figure visible, one with the second key figure visible. Then again two buttons assigning the analysis item these two data providers. Finally again the trick, making one another invisible.
    But this has the drawback, that after navigation, drill down, etc. in one view, then switching to the other cleary looses the navigation status.
    Thank you + regards,
    Ingo

    Problem has been solved

  • Column Visibility Expression help - SSRS

    I have a report in SSRS that has 12 columns. On each column, I have a corresponding column visibility expression like so:
     =IIF(InStr(JOIN(Parameters!HideColumns.Value,
    ","),"01")=0, False, True)
    Where I have the "01" I change to "02","03","04","05","06","07","08","09","10","11"
    & "12" respectfully across my column. The intent is to pass a parameter and allow the end user to "Hide" the column from visibility to allow them the flexibility on printing records. The issue I am having is I need a default that allows
    them to not hide anything, meaning print all 12 columns. Right now, its forcing me to pick one column to hide, is there something I could add to this to say, All? Hope this makes sense.

    Hi,
    For default value of this parameter(Parameters!HideColumns.Value)
    add  a value that is not in 01 to 12 .
    As an example if you  add 13 to the  default value   of the parameter, than  your expression will not hide the column 
       =IIF(InStr("13",
    ","),"01")=0, False, True) 
       =IIF(InStr("13",
    ","),"02")=0, False, True)  and so on.
    Many Thanks
    Chandra
    Please mark the post has answered if this post helps to solve your issue

  • Column Visibility in SSRS

    I am using SSRS 2012 for my report. I want to hide certain columns in the report. I don't want to see spaces between columns in my report when a middle column visibility is set to hide. I have an expression that hides or makes visible a certain
    column base on the value selected. But the issue I have with this is that I see spaces between columns in the table when the report is rendered.
    =IIF(CBool(Parameters!Column.Value)=True,True,False)
    In the image below, I want to be able to hide the Code column at the middle of the table without seeing any gap between columns in the table. Thanks for the help.
    Zionlite

    Hi Yokoos,
    According to your description, you have a parameter in your report to control the visibility of a column. Now you find there is blank space on the location of the column that is hidden. Right?
    In Reporting Service, if you just set visibility for the cells instead of the column/row, the space of the column/row will be reserved and that will generate/cause blank space at run time. So in your scenario, you just need to put your expression into column
    visibility to achieve your goal. Here are screenshots for your reference:
    Reference:
    Column Visibility Dialog Box (Report Builder)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou
      

  • WPF Data Grid Column Visibility Toggle Issue

    I have a WPF control that is used in multiple dialog forms. In one of these, I want to include a checkbox column along with two buttons that fire a method to either include all (check all the boxes) or exclude all (uncheck all the boxes.)
    I setup a Boolean variable to control this "IsExcludeVisible"
    Here is a snippet of the xaml:
    <Grid>  
    <Grid.ColumnDefinitions>
       <ColumnDefinition Width="Auto" />
       <ColumnDefinition Width="*"/>
     </Grid.ColumnDefinitions>
           <common:BaseDataGrid
      Name="grd"
      AutoGenerateColumns="False"            
      ItemsSource="{Binding ExcludeRoundingIngredientList}">
       <DataGrid.Columns>
         <DataGridTextColumn Header="Code" Binding="{Binding IngredientNumber}" />
         <DataGridTextColumn Header="Ingredient" Binding="{Binding Name}" />
               <DataGridCheckBoxColumn Header="Exclude"
    Visibility="{Binding IsExcludeVisible,
                                         Converter={StaticResource VisibilityConverter}}"
                                       Binding="{Binding MillBatchMixExclude}" />
               <DataGridComboBoxColumn Header="Rounding"
        DisplayMemberPath="Name"
                                    SelectedValuePath="RoundingId"
        SelectedValueBinding="{Binding MillBatchMixRoundingId}"
        ItemsSource="{Binding DataContext.RoundingOptions,Source={StaticResource Spy}}" />
         </DataGrid.Columns>
            </common:BaseDataGrid>
      <StackPanel ......
       <Button
        Content="Include All"
                    x:Name="btnIncludeAll"
    Visibility="{Binding IsExcludeVisible, Converter={StaticResource VisibilityConverter}}"
        csla:InvokeMethod.MethodName="IncludeAll"
        csla:InvokeMethod.TriggerEvent="Click"
        />
       <Button
        Content="Exclude All"
    Visibility="{Binding IsExcludeVisible, Converter={StaticResource VisibilityConverter}}"
        csla:InvokeMethod.MethodName="ExcludeAll"
        csla:InvokeMethod.TriggerEvent="Click"
        />
      </StackPanel>
     </Grid>...
    The button visibility toggles based on the IsExcludeVisible value as expected but the column visibility is totally unaffected.
    Am I missing something here (which obviously I am.)
    Below is my code to determine the value of the Boolean variable.
    public bool IsExcludeVisible
    get { return (SelectedReport.Name ==
    "Horizontal Batch Mix"); }
    Tom Mann MCSD C#

    I think the best way is to make a label function something
    like this (just off the top of my head, not tested):
    public function rate_label(item:Object,
    column:DataGridColumn):String
    return "GBP"+item.prdt_rate;
    Then in the DataGridColumn add a property:
    labelFunction="rate_label"

  • Datagridcolumn visible=false acting weird

    Hi everybody!
    I have problems with a few columns that shows up again when I
    do send to the httpService that is the dataProvider to the
    datagrid. The stay hidden if I use a repeater, but not when I use
    the httpService. I downloaded the hotfix hoping for a solution, but
    that didn't not solve it.
    Is there a work around, or do I have to wait for next
    hotfix?

    I have experienced several issues with this issue. Although
    the latest version addressed most of them, there seems to be
    certain instances where it still happens.
    Try this.
    Create a function like.
    public function setHiddenColumns():void {
    LastActivityDate.visible = false;
    OwnerName.visible = false;
    Then call the function on CreationComplete and after your
    remote object result.
    Also, I have noticed some different results with how your
    DataGrid columns are ordered in your code. Try putting a field that
    is always visible as the last column. So, make sure you don't have
    a hidden column as your last column. It fixed my issue.

  • Af:column visible property

    Hi,
    I am using JDeveloper 11.1.1.4 and ADF-BC in my application.
    I want to pragmatically control the visible property of the af:column inside the table.
    I have the following code for af:column.
    <af:column sortable="false" headerText="Impact Cat New" id="c7" visible="#{row.bindings.Selected.inputValue}">
    </af:column>
    Initially, the value of 'Selected' will be false when the table is first displayed and hence it should NOT be displayed.
    In the table selection listener,I set the property 'Selected' to true for the selected row and refresh the table[AdfFacesContext.getCurrentInstance().addPartialTarget(tblEmp)].
    But Even after refresh the table is never showing the column for which visible is set as true.
    The table is inside a panelCollection.
    Please advice.
    Regards,
    Praveen

    This won't work, as the column is the container for all rows and the row attribute is only available when the table rows arr stamped. I don't understand your use case. You want to show a column if one row gets selected? Sounds odd to me.
    If you really want to do this, you have to set an attribute outside the table and use the selection listener to switch this attrbute. Then use the new attribute in the columns visible property.
    Timo

  • How to set different row - column visibility attribute

    Hi all:
       I have one table in webdynpro for java. For example it have 4 rows, I need to set one column as different visible for row 1st and row 2nd .
               column1   column2
    row1      x               -
    row2      -               x
    Can I set it ?
    Thanks a lot.

    ya sure, u can
    make a visibility element and assign it to the tablecelleditor of each column of ur table. Now in the code, u must have bound the table to a node,  make the visibility element in the same node. Whichever row u want to make invisible, write the following code:
    wdcontext.node<nodename>.get<node name>elementat(<the row which u wish to make invisible>).set<visibility context>(wdvisibility.NONE);
    it will work.
    Let me know if u need further help....
    All The Best!!!
    Regards
    Gita

  • Can you make a column in atable invisible

    Hi,
    I am using the defaulttablemodel to display my table.
    The data are in a vector which are sorted in descending order based on a column.
    Is it possible to make a column in a table invisible.
    The reason is that I need to sort my table based on a particular column but i don't want to display that column.
    ---thanks

    Hi,
    I tried to code yout example:
    JTableHeader header = tblKundenInteressenten.getTableHeader();
    header.setReorderingAllowed(false);
    DefaultTableColumnModel columnModel = (DefaultTableColumnModel) header.getColumnModel();
    int lastIndex = columnModel.getColumnCount() - 1;
    TableColumn columnOid = columnModel.getColumn(lastIndex);
    columnModel.removeColumn(columnOid);
    header.setColumnModel(columnModel);
    tblKundenInteressenten.setTableHeader(header);
    ...but whenever I want to get the data back like this:
    DefaultTableModel dtm = (DefaultTableModel) tblKundenInteressenten.getModel();
    Vector daten = dtm.getDataVector();
    Vector zeile = (Vector) daten.firstElement();
    String oid = (String) zeile.lastElement();
    System.out.println("OID: " + oid);
    I have an empty JTable in my GUI ...
    what happened?

  • How to make table as "editable false"

    Dear Forum,
    i am user of jDeveloper jClient/Swing .jpr.
    cutomer table having following attributes-
    1.cust_id (primary key)
    2.cust_name
    3.cust_add
    Suppose customerview bind with jTable1.
    Using ViewObjectEditor, i set "updateable never" for all fields.
    This show error, when data insert into table " cust_id as
    read only".
    Help me, Using jClient Binding how to make Table as "editable false".

    Overriding method prepareEditor() for new table:
    private JTable tableList = new JTable(){
    public Component prepareEditor(TableCellEditor editor, int row, int column) {
    // 1 and 2 column is not editable
    if(column == 0 || column == 1){ return null; }
    return super.prepareEditor(editor, row, column);

  • How to make a column in Table popin read only

    Hi Everyone
    Could anyone let me know how to make a column in table popin read only.
    Regards

    if you ar eusing an ALV table
    try this
      DATA: lr_salv_wd_table TYPE REF TO iwci_salv_wd_table,
            r_table TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
    * get reference to ALV component interface
      lr_salv_wd_table = wd_this->wd_cpifc_alvmain( ).
    * get ConfigurationModel from ALV Component
      wd_this->r_table = lr_salv_wd_table->get_model( ).
    * init ColumnSettings
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
            lr_col_header TYPE REF TO cl_salv_wd_column_header.
      lr_column_settings ?= wd_this->r_table.
    * get table of column settings - each line one column
      DATA: lt_columns TYPE salv_wd_t_column_ref.
      lt_columns = lr_column_settings->get_columns( ).
    * loop over table - in each loop another column can be modified
      DATA: ls_column TYPE salv_wd_s_column_ref.
    * define visible columns (fields) by naming them,
    * exclude others by setting visibility to none
      DATA: ls_tooltip TYPE string.
      LOOP AT lt_columns INTO ls_column.
        " get header of column
        lr_col_header = ls_column-r_column->get_header( ).
        " do settings here
    ENDLOOP.
    Or see this document for more tips.
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40794172-b95a-2910-fb98-b86d8a0918b4">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40794172-b95a-2910-fb98-b86d8a0918b4</a>
    regards,
    Joris

  • Set visible=false in Label not removing its space in screen

    Hi All,
    I have three labels ony by one having width=100% for all.
    For some reason, now I want to make 2nd label invisible in
    the screen.
    So I set visible="false" for the 2nd label. Now I cannot the
    see the text displayed by the 2nd Label, but I can see the space
    occupied by the Label.
    I mean that, now i am getting the first label text, and have
    blank row which has the text earlier, but not now and thrid row
    with 3rd label text.
    Also I checked that, if I set the height of the 2nd Label to
    0 then also its not completely removing the 2nd row, only
    possibility I found was completely comment the code for the 2nd
    Label is the only way to hide the 2nd row :)
    Any help would be appreciated.

    Hi Sujit,
    Thanks for giving an useful tip which is new to me. But still
    I can see a little space between the first and 3rd label.
    Now this little space comes from the default space between
    the controls. After few trials I found that there is a property
    called "verticalGap" for the containter which holds these 3 labels.
    I set the value to 0(zero) for verticalGap. Now the issue resolved
    Thanks for a useful post

Maybe you are looking for

  • Child .swf controlling parent timeline

    Hello Captivate Heroes, I've searched around, and can't seem to find any solid info on an issue my team is having. I'm a bit of a noob when it comes to Javascript, so I apologize if this question is too basic for this forum. Is it possible for an emb

  • System copy Oracle 10.2 in MSCS

    Hi, we need to move (using system copy) for a old MSCS cluster to new HW MSCS cluster of our NW04s (Abap and Java) + Oracle 10.2.0.2 + Win03 X86. I would like to use backup/restore method due a very large Oracle database. OK, I've already move a stan

  • Infopath - Show All values in Text box From PeoplePicker control (Display Name)

    I have One People Picker Control and one Text box.I set Value of Text box to "Display Name" and problem is that it show only First Value.so is there a way to show all values of "Display Name" in Text box ? Thanks

  • How to enable Gant view for migrated Task Lists in SharePoint 2013

    We recently migrated several Task type Lists from an old SharePoint environment (WSS on SP 2003) to SharePoint Enterprise 2013.  I do not see the Timeline, Calendar and Gant View options available for the migrated Views of the migrated lists like I s

  • Adobe Reader X cosmetic bug - browser integration scrollbars do not move

    There appears to be a cosmetic bug in Adobe Reader X (10.0.0) browser integration. When you open a PDF in a browser window, the scroll bar remains at the top of the window when you scroll the PDF using page up / page down, or the mousewheel. If you m