FlexGrid - Making row cells read only based on row binding

Posted by: tim_bendon on 11 February 2021, 6:16 pm EST

  • Posted 11 February 2021, 6:16 pm EST

    I need to make the cells in a row read only based on the value entered in another call in the row. I want to style the readonly cells so just trapping and cancelling edit does not work for my scenario.

    Is it possible to bind isReadOnly in a wj-flex-grid-column?

    e.g. I want to do something like:

    <wj-flex-grid-column
                [header]="Parameter1"
                [binding]="'parameter1'"
                [minWidth]="75"
                [width]="100"
            ></wj-flex-grid-column>
            <wj-flex-grid-column
                [header]="DependentParameter1"
                [binding]="'dependentParameter1'"
                [minWidth]="75"
                [width]="100"
                [isReadOnly]="'parameter1 > 50'"
            >
            </wj-flex-grid-column>
    
  • Posted 12 February 2021, 7:20 am EST

    Hi Tim,

    Setting isReadOnly to the column affects all the cells. In order to prevent editing some cells in the column, you will need to handle the beginningEdit event of the FlexGrid and cancel the editing if parameter1 is greater than 50.

    You can also use the formatItem event to add custom CSS classes for read-only cells. Please refer to the sample link below for reference:

    https://stackblitz.com/edit/angular-9-0-0-rc-1-svxjw6

    Regards,

    Ashwin

  • Posted 12 February 2021, 8:02 am EST

    Thanks, I’ll take a look and get back but looks straight forward.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels