on 09-01-2008 6:32 AM
How can we enable or disable a particular column of a table at run time
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ppl,
How about enabling and disabling table cell editor row wise?
For example, my table has 2 columns and number of rows depends on FM output. Column 1 has table cell editor as "input field" which should be enabled / disabled based on the values in column 2.
Say, For row 1, column 1 should be enabled. But for row 2, the same column 1should be disabled.
Very dynamic and the enable/disable decision is based on the value in column 2 coming from the FM. This is my requirement. Do you think its somehow possible? Pls let me know..
Thanks & Regards,
Kavitha
Yes, that's possible.
Example: Table with two columns, first column: InputField, second column LinkToAction. Link in each row should be enabled if value in input field is greater than 7.
Context:
Rows (node, cardinality=0;n)
-- value (integer)
-- linkEnabled (boolean, read-only, calculated=true)
Data binding:
InputField.value = Rows/@value
LinkToAction.enabled = Rows/@linkEnabled
Getter for calculated attribute:
boolean getRowsLinkEnabled(IRowsElement element)
{
return element.getValue() > 7;
}
Armin
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);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.