We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Apply Column Chooser to grid with a custom command column resulting in javascript timeout / browser hang

Hi, Syncfusion's admin,

I have a problem when using column chooser feature.
When column chooser applied in grid with a custom command column, the browser would hang (using firefox).
After i click stop script execution, a warning is shown in firefox console :

Error: Script terminated by timeout at: inArray@http://localhost:62501/jsbundles/jquery?v=BkQaZq6LCDeSX6OyYCg-MjSKGQX4bUH3YXGVNrzNGio1:1:101948 showColumns@http://localhost:62501/Scripts/ej/ej.widget.custom.min.js?v=636720097743422623:10:1998257 _addButtonCC@http://localhost:62501/Scripts/ej/ej.widget.custom.min.js?v=636720097743422623:10:2469520 r@http://localhost:62501/jsbundles/jquery?v=BkQaZq6LCDeSX6OyYCg-MjSKGQX4bUH3YXGVNrzNGio1:1:173014 _trigger@http://localhost:62501/Scripts/ej/ej.widget.custom.min.js?v=636720097743422623:10:13370 _btnMouseClickEvent@http://localhost:62501/Scripts/ej/ej.widget.custom.min.js?v=636720097743422623:10:38371 t.proxy/<@http://localhost:62501/Scripts/ej/ej.widget.custom.min.js?v=636720097743422623:10:27405 dispatch@http://localhost:62501/jsbundles/jquery?v=BkQaZq6LCDeSX6OyYCg-MjSKGQX4bUH3YXGVNrzNGio1:1:137137 add/a.handle@http://localhost:62501/jsbundles/jquery?v=BkQaZq6LCDeSX6OyYCg-MjSKGQX4bUH3YXGVNrzNGio1:1:135209

4 Replies

EK Edwin Kurniawan December 8, 2018 06:52 AM

I think i found what was triggering the script execution timeout, i was using 2 command columns with no header text which makes the script buggy because of the ambiguous columns.

For now, i just use 1 command column.
Please let me know if there is any fix or workaround.


VN Vignesh Natarajan Syncfusion Team December 10, 2018 09:24 AM

Hi Edward, 
 
Query: “i was using 2 command columns with no header text which makes the script buggy because of the ambiguous columns. ” 
 
From your query, we understand that you are facing issue while using columnChooser when two command column has no headertext. By default while using columnChooser we will loop through column and hide/show column based on the field value or headerText. But in your scenario field is undefined and HeaderText will also be empty. So this is the cause of the issue. No two columns can have same headerText similar to empty text).  
 
If you still wish to have two custom command column without headerText, then we suggest you to define as headerText as “<a></a>” for any one of the column. refer the below code example 
 
@(Html.EJ().Grid<EditableOrder>("CommandGrid") 
.                .                 .                  .       .                 .       .              .  
col.Field("ShipCountry").HeaderText("Ship Country").Width(90).Add();            col.Field("Verified").HeaderText("Verified").EditType(EditingType.BooleanEdit).Width(75).Add(); 
                col.HeaderText("").Commands(command => 
                { 
                    command.Type(UnboundType.Edit) 
                           .ButtonOptions(new Syncfusion.JavaScript.Models.ButtonProperties() 
                           { 
                               Text = "Edit" 
                           }).Add(); 
                }).IsUnbound(true).Width(130).Add(); 
                col.HeaderText("<a></a>").Commands(command => 
                { 
                    command.Type(UnboundType.Save) 
                     .ButtonOptions(new Syncfusion.JavaScript.Models.ButtonProperties() 
                     { 
                         Text = "Save" 
                     }).Add(); 
                }).IsUnbound(true).Width(130).Add();               
 
            }) 
) 
   
Note:  This is just a workaround. So it has some limitations. 
 
Regards, 
Vignesh Natarajan 



EK Edwin Kurniawan December 10, 2018 11:40 PM

Thank you for the reply Vignesh.

I've tried your suggestion and it works fine with my code.


MP Manivannan Padmanaban Syncfusion Team December 11, 2018 10:40 PM

Hi Edward, 

Thanks for the update. 

We are happy to hear that the reported issue was resolved. Please let us know if you need further assistance. 

Regards, 

Manivannan Padmanaban. 



Loader.
Live Chat Icon For mobile
Up arrow icon