Record removed from Editable table even though validation failed

Record removed from Editable table even though validation failed

  
Hi EveryOne,

I am facing problem while deleting a record in editable table.
The scenario is as below

I am having 3 entities with structures as below

ParentTable columns:
Pid
Pcolumn1
Pcolumn2

ChildTable Columns:
Cid
Ccolumn1
Ccolumn2
Pid

ChildChildTable Columns:
Ccid
CCcolumn1
CCcolumn2
cid

Now i am displaying the ChildTable using editable table. Now while deleting the record in this table i need to check if there exists any data in ChildChildTable With that Cid. If data exists then need to display validation instead of deleting. I wrote that on server side , but the editable table deleting that record from ui(not from DB).
How to avoid that?
For better understanding of problem I attached my espace. If my question is not clear please tell me, I will try to explain in more detail.

In attached espace I didn't created ChildChildTable, but implimented that in deletechild action. Please help.

Thanks in advance.

 Hi Salini, 

If I understood what you are asking is how to prevent the delete from happening giving the existence of a record with the same CID in another table (ChildChild table). In your example the physical delete never happened because you had a condition with True and you are just sending a feedback message without deleting or refreshing the EditableTable. If you don't refresh the EditableTable the record was not deleted from the EditableTable but it was removed from the table. So in order to revert the removal from the UI you just need to ajax refresh the EditableTable.

In the picture below I placed the common flow for the scenario that you have described:


Let me know if this helped. 

Elísio

Hi, I am not able to see the image, can you please upload one more time

Thanks

 Hi Salini, 

If I understood what you are asking is how to prevent the delete from happening giving the existence of a record with the same CID in another table (ChildChild table). In your example the physical delete never happened because you had a condition with True and your are just sending a feedback message without deleting or refreshing the EditableTable. 
In the picture below I placed the common flow for the scenario that you have described:

Inline image 1
Let me know if this helped. 

Elísio
 
 
 
I've edited the post, can you see the image now?

Salini p wrote:
Hi, I am not able to see the image, can you please upload one more time

Thanks

 Hi Salini, 

If I understood what you are asking is how to prevent the delete from happening giving the existence of a record with the same CID in another table (ChildChild table). In your example the physical delete never happened because you had a condition with True and your are just sending a feedback message without deleting or refreshing the EditableTable. 
In the picture below I placed the common flow for the scenario that you have described:

Inline image 1
Let me know if this helped. 

Elísio
 
 
 
 
 
Yeah Elisio,
Now i am able to see the diagram.
That is the exact logic of my scenario, while creating sample instead of checking ChildChild table I directly used true.
The problem now is when i am trying to refresh the Editable table in OnRowDelete event then it is giving me error. It is there in the sample, can you tell me please how to solve that error

Thanks
Salini


Elísio Simão wrote:
I've edited the post, can you see the image now?