isReadOnly toggle on a cell

Posted by: grapecity on 23 October 2017, 9:11 am EST

    • Post Options:
    • Link

    Posted 23 October 2017, 9:11 am EST

    If I understand correctly, isReadOnly will only apply to grid or column or row.

    Is there a way that I can toggle isReadOnly of a single cell on and off when the cell is selected or deselected. If so, do have any sample code of it? Than you very much.

  • Posted 23 October 2017, 4:55 pm EST

    Hi Hoang,

    Yes, You are correct, in FlexGrid, Row or Column can be set to read-only not cell.

    If you would like to prevent editing for specific cell, you need to handle beginningEdit. Please refer to the following code snippet:

    HTML Tag:

    <wj-flex-grid #flex [itemsSource]="data" (beginningEdit)="onBeginningEdit(flex,$event)"></wj-flex-grid>
    

    TS Code

    onBeginningEdit(s:wjGrid.FlexGrid,e:wjGrid.CellRangeEventArgs){
    	if(s.rows[e.row].dataItem.country=="US" && s.columns[e.col].binding=="downloads"){
    		e.cancel=true;
    	}
    }
    

    In the above code snippet, if the cell is for downloads column and country value for this item is US, the user can not edit the cell value.

    ~Manish

Need extra support?

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

Learn More

Forum Channels