Strange behavior with Edit Dialog or Detail Template only works first time

Hello there.

I'm using SfGrid with Edit Dialog Template and inside a SfTab.

When I double click a row it opens the edit dialog fine just the first time. If I close the dialog and repeat the double click action it shows the error "Event is already tracked" and the dialog doesn't display well, it duplicates the data and crashes.

edit_dialog_grid.jpg

I put a breakpoint on the OnActionBegin event to see what was happening and it turns out that everything works fine thanks to the breakpoint pause. It gives the time to render or refresh something and somewhere and display the edit dialog correctly.

The same thing happens whit the DetailTemplate whit Tabs inside. The first time I open the row detail works well, but the second time it duplicates the data.

detail_grid.png


Again, I put a breakpoint on the DetailDataBound event and the pause makes everything works fine.

I tried adding a Task.Delay() and a Task.Yield() in the OnActionBegin event or the DetailDataBound event, but is not working. I know i need that pause somwhere but I don't know where or how to put it.

Can you please help me or tell me what am I doing wrong ?

Thanks in advance.





5 Replies

VN Vignesh Natarajan Syncfusion Team November 16, 2021 06:11 AM UTC

Hi Jennifer,  

Thanks for contacting Syncfusion support.  

Query: “If I close the dialog and repeat the double click action it shows the error "Event is already tracked" and the dialog doesn't display well, it duplicates the data and crashes. 

From your query we understand that you are facing issue while editing the record for second time in WebAssembly application. We need following details to validate the reported query further at our end. So kindly share the following details.  

  1. Share the entire Grid code example along with dialog template component.
  2. If possible share simple issue reproducible sample.
  3. Kindly re-attach the screenshot with clarity, it will be very helpful for us to track down the issue.
  4. Also you have mentioned that pause in OnActionBegin event resolves the issue. we suspect that some actions gets initiated before another action is completed.
  5. Also ensure the reported issue by removing the contents of other tab. So that we can find issue occur dur to which component and which tab.

Above requested details will be very helpful for us to validate the reported query at our end and provide solution as soon as possible.   

Regards, 
Vignesh Natarajan 



JB Jennifer Benavides November 22, 2021 07:47 PM UTC

Hi.

I kind of solve my problem with this javascript function.


function removeRepeatedActiveTab() {
    setTimeout(function () {
        const detailsPanels = document.getElementsByClassName("e-detailcell");
        Array.from(detailsPanels).forEach((el) => {
            const isRepeated = el.getElementsByClassName("e-item e-active").length > 1
            if (isRepeated) {
                const el_rep = el.getElementsByClassName("e-item e-active")[0];
                el_rep.parentElement.removeChild(el_rep);
            }
       });
   }, 500);
}


Anyway, I send you my code to see if there's something wrong.

Thank you.


Attachment: ejemplo_grid_syncfusion_b980bd61.zip


VN Vignesh Natarajan Syncfusion Team November 23, 2021 07:32 AM UTC

Hi Jennifer,  

Thanks for the update.  

We are glad to hear that you have resolved your issue on your own.  

From your code we understand that you have removed the active item. Kindly get back to us if you are facing any further issues in future.  

Regards, 
Vignesh Natarajan  



JB Jennifer Benavides November 26, 2021 03:52 PM UTC

Well... I really want to know why is this happening ?  Because my "solution" is just a patch. It's not solving the real problem.  

This also happens when opening a second row detail, not only the same row detail. 

So, could you please try to replicate this issue and tell me if there's a solution?

Thank you in advance.



VN Vignesh Natarajan Syncfusion Team November 29, 2021 11:28 AM UTC

Hi Jennifer, 
 
Query: “This also happens when opening a second row detail, not only the same row detail.  
 
We have prepared a sample using your code example and Blazor WASM 5.0. We are not able to reproduce the reported issue at our end. Also from your code example we found that you have not enabled PrimaryKey column in Grid. Kindly ensure to define PrimaryKey column whose value is unique. Because based on PrimaryKey value only CRUD operation will take place.  
 
Kindly refer the below sample for your reference 
 
 
If you are still facing the reported issue, kindly get back to us with issue reproducible or try to reproduce the reported issue in provided sample. Because it will be very helpful for us to validate the reported issue further at our end and provide solution as early as possible.  
 
Regards, 
Vignesh Natarajan   
 
 


Loader.
Up arrow icon