Grid Template Column

I want to remove the template button based on value in row
I am using template refresh event.
it does not remove the button
what do I need to add to remove the template from the cell?
thanks

 col.HeaderText("Delete").Template("<input type=\"button\" value=\"Delete\"  data-toggle=\"tooltip\" title=\"Delete\" onclick=\"WorkOrderDatePartial_WorkOrderDateDelete_click(this)\" />").Width(75).Add();


 function dgWorkOrderDate_TempleteRefresh(args) {
        //alert('refresh');

       // var val = args.data["Id"];
        var cell = $(args.cell);

        //render the button control
        // if (val ==null || val==0 || val<1) {
        cell.find(".template").css("visibility", "hidden");
        cell.find(".template").remove();


    }

1 Reply

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team August 11, 2017 05:52 AM UTC

Hi Paul,  
 
Thanks for contacting Syncfusion Support.  
 
We can use the jsRender IF/Else cases and prevent the button’s visibility within the template. Refer to the following code example.  
 
@(Html.EJ().Grid<object>("Grid") 
        .Datasource((IEnumerable<object>)ViewBag.data) 
        .Columns(col => 
        { 
            col.Template("#columntemplate").Add(); 
               . . . 
        }) 
) 
 
    <script type="text/x-jsrender" id="columnTemplate"> 
        {{if EmployeeID % 2 == 0}} 
                      <input type="button" value="{{:EmployeeID}}"> 
        {{else}} 
                     <span>{{:EmployeeID}}</span> 
        {{/if}} 
    </script> 
 
 
Regards, 
Seeni Sakthi Kumar S. 


Loader.
Up arrow icon