ActionBegin - cancel isn't working

Hello,

I'm facing an issue that i'm not able to resolve.
I'm trying to cancel edit action on some cells.
I saw on the forum that there is a cancel property in cellSelecting and/or actionBegin.
But i'm facing 2 problems.
The first one is that cellSelecting doesn't trigger so i can't cancel here and secondly actionBegin does start but the cancel property change doesn't stop the edit action...
The cell i want to cancel the edit are on a colum and on some rows that have a particular property;

Here is my treegrid template declaration :
<template>
<div>
<ejs-treegrid :dataSource="tree"
:treeColumnIndex='1'
:editSettings='editSettings'
:rowDataBound='rowDataBound'
:cellSelecting="cellSelecting"
:actionBegin="actionBegin"
:actionComplete="actionComplete"
:queryCellInfo="queryCellInfo"
:allowSorting='true'
locale='fr-FR'
childMapping='Children'
gridLines='None'
width='auto'>
<e-columns>

The Column declaration :

<e-column
:customAttributes="{class: 'fraction-libre'}"
field='FractionLibre'
headerText='Fraction Libre'
textAlign='Left'
width=80>
</e-column>

Here the methods:

methods: {

cellSelecting: function (args){
console.log('CELL SELECTING : ', args);
},


/**
*/
actionBegin: function (args){
console.log('ACTION BEGIN : ', args);

if (args.type === "edit" && args.columnName === "FractionLibre" && args.rowData.TypeLigne !== "FR") {
console.log('CANCEL');
args.cancel = true;
}
},
And the console :



Not sure where the problem is, if you have any ideas...

Thanks you very much for your support !

3 Replies 1 reply marked as answer

MP Manivannan Padmanaban Syncfusion Team August 27, 2020 10:56 AM UTC

Hi Piedrot, 

Greetings from Syncfusion Support. 

Query 1: cellSelecting doesn't trigger so i can't cancel here 
 
The cellSelecting event will trigger when we set the selectionSettings.mode as ‘Cell’. By default, the selectionSettings.mode is ‘Row’. Refer to the below help documentation link, 

 
Query 2: actionBegin does start but the cancel property change doesn't stop the edit action 
 
The ActionBegin event cancel property change will work for EditMode 'Row' and from the shared code example, we can see that you are using EditMode as 'Cell.' For cell editing, we suggest that you use our CellEdit event instead of ActionBegin. And we discussed the same thing in the following Knowledge Base Help Document Link, 

 
Note: If you want to prevent a column from editing, we recommend that you set the allowEditing property as false in the column definition. Please refer to the below help documentation link, 
 

Please get back to us, if you need any further assistance. We 're happy to assist you. 

Regards, 
Manivannan Padmanaban 
 


Marked as answer

PG Piedrot Gyzmo August 27, 2020 01:13 PM UTC

The cellEdit event does the trick.

I didn't saw this knowledge base, thank you for pointed it out !

Thanks again for your support


MP Manivannan Padmanaban Syncfusion Team August 27, 2020 01:29 PM UTC

Hi Piedrot, 

Well, thank you for the update.  

We are glad to hear that the reported issue has been resolved. If you need more assistance, please come back to us. 

Regards, 
Manivannan Padmanaban 


Loader.
Up arrow icon