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

Display none Column list object print, if Data Has Been Scanned?

 @{

                    List<object> commands = new List<object>();

                    commands.Add(new { buttonOption = new { iconCss = "e-icons e-print", cssClass = "e-flat Print", id = "Print" } });

                   });

                }



                @Html.EJS().Grid("UrlAdaptor").DataSource((IEnumerable<object>)ViewBag.dataSource).CommandClick("CommandClick").AllowSorting().AllowResizing().AllowReordering().AllowGrouping().AllowFiltering().AllowExcelExport().ShowColumnChooser(true).Columns(col =>

           {

               col.HeaderText("Action").Commands(commands).Width("90").CustomAttributes(new { @class = "customcss" }).Add();


 function customiseCell(args) {

        if (args.column.field === 'Status') {

            if (args.data['Status'] == 'Data Has Not Been Scanned') {

                args.cell.classList.add('below-5');

               ........?

            } else if (args.data['Status'] == 'Data Has Been Scanned') {

                args.cell.classList.add('below-8');

               ......?

            }

        }

    }


1 Reply

PS Pavithra Subramaniyam Syncfusion Team December 22, 2022 07:25 AM UTC

Hi Maulana,


Thanks for contacting Syncfusion support.


From your query, we understood that you want to hide the custom Print command button for particular rows. If yes, you can achieve your requirements by using the “rowDataBound” event which will be triggered for each row rendering. Please refer to the below code example and documentation link for more information.


 

function rowDataBound(args) {

  if (!args.data.Verified) {

    args.row.querySelector('.Print').style.display = 'none';

  }

}

 


https://ej2.syncfusion.com/aspnetmvc/documentation/grid/row/row#using-event


Regards,

Pavithra S


Loader.
Up arrow icon