Skip to Content
avatar image
Former Member

How can we enable or disable a Column of a table at runtime

How can we enable or disable a particular column of a table at run time

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 01, 2008 at 05:41 AM

    Hi Raghunandan,

    Take one Boolean value in the context and bind it to the Particular column --> Table cell editor --> enable Property . Set it's value to True/False to Enable/Disable Column when your Required Condition Satisfies.

    With Regards,

    Roop Kumar.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 05:35 AM

    HI,

    In wdDoModifyView() method write the code to set enable or disable as

    // if TableCellEditor of column is TextView then or replace //IWDTextView if any other..

    IWDTextView col=(IWDTextView)view.getElement(<textViewId>);

    if(<condition>)

    col.setEnabled(<true or false>);

    else

    col.setEnabled(true or false);

    Regards

    LN

    Edited by: Lakshmi Narayana Chowdary Namala on Sep 1, 2008 8:10 AM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 06:00 AM

    if you want to hide/show column thats what I understood use following properties:

    	itemCol.setVisible(WDVisibility.BLANK); //to hide column			
      	itemCol.setVisible(WDVisibility.VISIBLE); //to show column
    

    You can use LN's code to get your column, or iterate through the table object and modify your column properties.

    	IWDTable table = (IWDTable)view.getElement("myTable");
    	IWDAbstractTableColumn cols[] = table.getGroupedColumns(); //To get table column array
    	IWDTableColumn itemCol = null;
    			
    	for (int i=0; i< cols.length; i++)
    	{
    		itemCol = (IWDTableColumn) cols<i>;
    		if (<condition>)
    			itemCol.setVisible(WDVisibility.BLANK);
    		else
    			itemCol.setVisible(WDVisibility.VISIBLE);
    	}

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 06:07 AM

    hi...

    You can make use of the Visibility property of the Table column to meet your requirement.

    At runtime if you dont want to view particular column the Visible property of a column can be used.

    In wdmodify View

    IwdTableColumn column=(IwdTableColumn)view.getElement(<columnId>);

    if(<Condition>)

    column.setVisible(WDVisibility.NONE);

    else

    column.setVisible(WDVisibility.VISIBLE);

    but as per your post you want to enable or disable the Table column...

    this property can be applied only to the TableCellEditors which you can add in your TableColumn ...but not on the Table Column...Hope iam clear

    Regards

    Madhavi

    Add comment
    10|10000 characters needed characters exceeded

    • I realised it after posting :). Just moved the enable/disable value attrbitue to the node which is mapped to the table. And modified the code such that, while creating and adding node elements, i check the condition and set this enable/disable value too. It works!