Is it possible to work with new data in OnActionBegin with BeforeSave request type

Hi,

I want to check start and end dates of a task when editing, and to cancel the action if they are weekend days. I need this validation for some tasks, not all. I use dialog and taskbar editing.

In OnActionBegin event with "BeforeSave" request type, args.Data shows original data and args.RowData is null. After that OnActionComplete event is triggered and args.Data shows new data. I can only check the data in OnActionComplete but setting args.Cancel at that phase doesn't take the action back, so I need to cancel at OnActionBegin-BeforeSave.

I tried to get old data in OnActionBegin and set the datasource with old data in OnActionComplete or even later with a button click. I see the data changes at the backend but gantt doesn't load the data I set. Using RefreshAsync, RefreshColumnsAsync, StateHasChanged functions did not work. I could only work around by reloading the grid with old data but it is not a nice solution, showing a full refresh. I think the neatest solution would be canceling the action in "OnActionBegin" event.

Is there a way to accomplish this?

Thanks & best regards


5 Replies

PS Premkumar Sudalaimuthu Syncfusion Team March 14, 2022 02:35 PM UTC

Hi Yunus, 
 
Greetings from Syncfusion support!!! 
 
For dialog editing Action, you can get the original data from GanttActionEventargs.Rowdata in action begin event. After editing , you will get the edited data in GanttActionEventargs.Data with “BeforeSave” request type. Now, You can compare the date and cancel the editing action if it is on weekend. 
 
For taskbar editing, we can cancel the editing by setting the IncludeWeekend property to false. We have created feedback for this. you can track the issue status using this feedback URL - https://www.syncfusion.com/feedback/33300/the-gantt-taskbar-falls-on-weekends-event-disable-the-includeweekend-property. 
 
Thanks & Regards, 
Divya 



YU Yunus March 14, 2022 09:34 PM UTC

Hi Divya,

The feedback is private. Can you grant access so that I can review the solution please?

Kind regards

Yunus



MS Monisha Sivanthilingam Syncfusion Team March 16, 2022 01:03 PM UTC

Hi Yunus, 
 
We apologize for the inconvenience. 
 
We have provided access to the feedback to you. 
 
 
We will intimate you once the issue has been fixed. 
 
Regards, 
Monisha. 



YU Yunus March 21, 2022 10:04 AM UTC

Hi Monisha,
Thank you. I'll be waiting for the feedback's solution.


Hi Divya,

About the solution you offered about "DialogEditing";
" For dialog editing Action, you can get the original data from GanttActionEventargs.Rowdata in action begin event. After editing , you will get the edited data in GanttActionEventargs.Data with “BeforeSave” request type. Now, You can compare the date and cancel the editing action if it is on weekend. "

​I previously tried this, and it wasn't working. I tried it again after you wrote, but still it's not working. BeforeSave request type shows the original data, not the edited data, like I wrote in problem description:
" In OnActionBegin event with "BeforeSave" request type, args.Data shows original data and args.RowData is null. After that OnActionComplete event is triggered and args.Data shows new data. I can only check the data in OnActionComplete but setting args.Cancel at that phase doesn't take the action back, so I need to cancel at OnActionBegin-BeforeSave."

I cancel the operation and do not write to db in OnActionComplete, because I can only get the edited data at that phase. But the gantt reserves the last (edited) data, doesn't take the action back. So I need to make a full refresh to show the correct data.

Can you please check the scenario again?

Thanks & best regards



AK Alagumeena Kalaiselvan Syncfusion Team March 23, 2022 03:09 PM UTC

Hi Yunus, 
 
Query #1: I'll be waiting for the feedback's solution 
 
The issue fix will be available for our Volume 1 main release on 23rd march, 2022. We would appreciate your patience until then. 
 
Query #2: I previously tried this, and it wasn't working. I tried it again after you wrote, but still it's not working. BeforeSave request type shows the original data, not the edited data, like I wrote in problem description:
In OnActionBegin event with "BeforeSave" request type, args.Data shows original data and args.RowData is null. After that OnActionComplete event is triggered and args.Data shows new data. I can only check the data in OnActionComplete but setting args.Cancel at that phase doesn't take the action back, so I need to cancel at OnActionBegin-BeforeSave." I cancel the operation and do not write to db in OnActionComplete, because I can only get the edited data at that phase. But the gantt reserves the last (edited) data, doesn't take the action back. So I need to make a full refresh to show the correct data.
 
 
We have validated the query and as per the Gantt behavior the Modified data is exist in args.Data of ActionBegin event with BeforeSave request type. So, you can do the validation/revert the edit action based on the modified data but currently we are facing issue as the modified data not property shown in args.Data of ActionBegin event. So, we have considered this case as defect and logged bug report which status can be tracked from below link. 
 
We will fix this issue and included in patch release on 13th March, 2022. 
 
Regards 
Alagumeena.K 
 


Loader.
Up arrow icon