Posted 30 January 2019, 2:50 am EST
Is there a way to accomplish this? I have two interconnected columns and when I add a value into a cell in one column, the cell in the same row in the other column should be disabled
Forums Home / Spread / DataViewsJS
Posted by: jgalera on 30 January 2019, 2:50 am EST
Posted 30 January 2019, 2:50 am EST
Is there a way to accomplish this? I have two interconnected columns and when I add a value into a cell in one column, the cell in the same row in the other column should be disabled
Posted 31 January 2019, 12:34 am EST
Hello,
You can lock the row in editing event while cancelling the event.
For example:
dataView.editing.addHandler(function(sender, args) {
if (args.status === ‘beforeStartEditing’ && args.oldItem.id != -1) {
args.cancel = true;
}
});
Thanks,
Deepak Sharma
Posted 1 February 2019, 6:04 am EST
That only works if the edit mode is row where i dont care about which column.
When the edit unit is cell, you do not pass the columnindex in the beforeStartEditing event.
We need to cancel the edit event for a single cell, for a single column.
Posted 4 February 2019, 1:04 am EST
Hello,
In case you wish to lock a particular column , you can use the code as below:
var columns = [
{
id: “id”,
caption: “Id”,
dataField: “id”,
width: 80,
allowEditing: false // to lock the column
},
Thanks,
Deepak Sharma
Posted 4 February 2019, 4:03 am EST
We need to cancel the edit event for a single cell, for a single column. when edit mode is cell.
The beforeStartEditing in the args param, only row (row index) is provided, we also need the col (col index). That way we know which cell is starting to edit and hence can cancel.
I can see in your code base, you know which cell/col, but not sending it in part of args.
We need that tiny bit of data.
Posted 4 February 2019, 8:44 pm EST
Hello,
For this you functionality, I would suggest you to use Spread.Sheets which allows accessing the row/column and cell individually.
Thanks,
Deepak Sharma