Skip to Content
avatar image
Former Member

How to enable and disable columns fields within a table

Hello all,

I have the following situation,

I need to build a table who has an check box. If i check it, i must to enable and disable (depends of the case) some columns fields of my table´s line. I´ve search some forums thread and i know that this code must be develop on wdmodify view method. But i wonder if you guys have some sample codes or maybe a Weblog link that could help me to solve this problem.

Thank you in advance,

Mariana

Rewards the GURU who save my life jejeje...

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 07, 2008 at 09:35 AM

    First, it is not true that you have to code this in method wdDoModifyView(). Don't believe everything you read in this forum 😉

    Please describe your use-case more clearly. Do you want to have a table column with a checkbox which controls the enabling-state of some other editors in the same table row?

    If yes, just

    - add a boolean context attribute "editorsEnabled" under the data source node

    - bind the "enabled" property of each cell editor that should be controlled to this attribute

    - bind the "checked" property of the CheckBox to this attribute

    - assign an empty action to the "onToggle" event of the CheckBox. This will trigger a roundtrip when the checkbox is toggled and update the editor's enabled state directly

    Armin

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      If you can't add the attribute directly to the node, add a cardinality 1:1, selection 1:1 subnode to the node and add the attribute into the subnode.

      Armin

  • avatar image
    Former Member
    Jun 06, 2008 at 07:51 PM

    Create new Context Attribute of type "boolean" in the node(i.e, dataSource bound to that table). Bind the new context attribute to "enabled" property of TableCell Editor. write an event handler for checkbox which would disable / enable the table cell.

    if you are not clear, please post your context structure so that we can provide the exact code.

    Cheers,

    ~kranthi

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      well i have a table in which the columns are bound to several model attribute (not only one i.e.: DataSource1 to cell1, DataSource2 to cell2 and so on)..each cell have a different behavior, i mean one list one type of data as a dropdown list (example a project name), one shows a search screen, etc. The only thing i want to do is if i check the checkbox only (and only) enable example: cell2 and cell3 and disable cell4 and cell5 (cell1 is the checkbox), but if i don't check it, the cell2 and cell3 remain disable. that must happen only on the layout level (client side event). Obviously, all my cells are linked (or bound) to different model node as i said before, so i know that i cant create an attribute within the model node. But i'm wondering if i could do what you tell me to do, creating several attribute of the main context (each for every cell) and set those to the property and manipulate the value of each cell if the action of the checkbox is activated. I´m developing the view so i haven't implemented yet. i'm at a design face.

      Regards

      MC