Hide custom commands button on the editing

I want to hide, a custom command button on the editing mode.

But keep in mind I am using Is Frozen in this column.

I was trying (ActionComplete) but it's working not well because, i used Frozen columns.

Please check my code and snapshot.

Attachment: iconhiddeneditmode_62993f4a.zip

3 Replies 1 reply marked as answer

AG Ajith Govarthan Syncfusion Team May 5, 2021 03:36 PM UTC

Hi Rizwan, 

Thanks for contacting Syncfusion support. 

Query: I want to hide, a custom command button on the editing mode. But keep in mind I am using Is Frozen in this column. I was trying (ActionComplete) but it's working not well because, i used Frozen columns. 
 
Based on your query you want to hide the custom command button item while in edit mode. So, we have prepared sample in that we have hidden the custom command button in the edit mode using the actionComplete event. For your convenience we have attached the sample, please refer them for your reference. 

Code Example: 
Index.cshtml 

@{ 
    List<object> commands = new List<object>(); 
    commands.Add(new { type = "userstatus", buttonOption = new { content = "Details", iconCss = "bg-icons e-btngrp-star", cssClass = "e-flat c-custom" } }); 
    commands.Add(new { type = "Edit", buttonOption = new { iconCss = "e-icons e-edit", cssClass = "e-flat" } }); 
    commands.Add(new { type = "Delete", buttonOption = new { iconCss = "e-icons e-delete", cssClass = "e-flat" } }); 
    commands.Add(new { type = "Save", buttonOption = new { iconCss = "e-icons e-update", cssClass = "e-flat" } }); 
    commands.Add(new { type = "Cancel", buttonOption = new { iconCss = "e-icons e-cancel-icon", cssClass = "e-flat" } }); 
} 
 
<div class="control-section"> 
    @Html.EJS().Grid("DefaultPaging").ActionComplete("actionComplete").DataSource(ds => ds.Url("/Home/UrlDatasource").Adaptor("UrlAdaptor").InsertUrl("/Home/Insert").RemoveUrl("/Home/Remove").UpdateUrl("/Home/Update")).Columns(col => 
{ 
    col.HeaderText("Manage Records").IsFrozen(true).Width("160").Commands(commands).Add(); 
 
    col.Field("OrderID").HeaderText("Order ID").IsFrozen(true).Width("120").IsPrimaryKey(true).Filter(new { type = "CheckBox" }).TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add(); 
    col.Field("CustomerID").HeaderText("Customer Name").Width("170").Add(); 
    col.Field("OrderDate").HeaderText("Order Date").Width("130").EditType("datepickeredit").Format("yMd").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add(); 
    col.Field("Freight").HeaderText("Freight").Width("120").Format("C2").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add(); 
    col.Field("ShipCountry").EditType("dropdownedit").HeaderText("Ship Country").Width("150").Add(); 
 
}).Height("400").AllowPaging().Toolbar(new List<string> 
        () { "Add", "Edit", "Delete", "Update", "Cancel" }).AllowFiltering().FilterSettings(filter => filter.Type(Syncfusion.EJ2.Grids.FilterType.Menu)).EditSettings(edit => { edit.AllowEditing(true).AllowAdding(true).AllowDeleting(true); }).Render() 
</div> 
<script> 
   
    function actionComplete(args) { 
        if (args.requestType === "beginEdit") { 
            args.form.querySelector(".c-custom") ? args.form.querySelector(".c-custom").classList.add("e-hide") : args.movableForm.querySelector(".c-custom").classList.add("e-hide") ; 
        } 
    } 
</script> 


Please get back to us if you need further assistance. 

Regards, 
Ajith G. 


Marked as answer

RI Rizwan May 6, 2021 05:57 AM UTC

Thank you,
It's working fine.



AG Ajith Govarthan Syncfusion Team May 7, 2021 05:03 AM UTC

Hi Rizwan, 

Thanks for the update. 

We are happy to hear that your issue has been resolved. 

Please get back to us if you need further assistance. 

Regards, 
Ajith G. 


Loader.
Up arrow icon