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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

boolean renderer for null-value

Thread ID:

Created:

Updated:

Platform:

Replies:

149783 Dec 9,2019 10:59 AM UTC Dec 16,2019 11:11 AM UTC Vue 5
loading
Tags: Data Grid
Michael Kornatzki
Asked On December 9, 2019 10:59 AM UTC

In my table i have a column with values of true, false and null.

If i use "displayAsCheckBox" even for the null-value a checkbox is rendered.

How can i get an empty cell instead of a checkbox?

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On December 9, 2019 12:11 PM UTC

Hi Michael, 

Using the queryCellInfo event, any cell can be customized. In your case, if the respective column data is null (instead of the true/false), just empty the args.cell value (args.cell.innerHTML = ‘’).  


Regards,  
Seeni Sakthi Kumar S 


Michael Kornatzki
Replied On December 9, 2019 12:23 PM UTC

Hi Seeni,

is there also another way like a column-renderer?
Otherwise if i have many columns and rows i have to check all the time if it was a cell of a boolean rendered column.

Kind regards,
michael


Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On December 10, 2019 06:47 AM UTC

Hi Michael,  

We can understand your concern about the performance lag over the continuous triggering of the Grid’s queryCellInfo. So we suggest to use the rowDataBound event of the Grid. Refer to the following code example.  


Regards,  
Seeni Sakthi Kumar S 


Michael Kornatzki
Replied On December 16, 2019 06:16 AM UTC

Hi Seeni,
is there any other way?

For all of our tables cells with boolean null should not show a checkbox.
I need something universally like

      if (args.column.type === "boolean") {
        if (isNullOrUndefined(args.cell.value)) {
          args.cell.innerHTML = "";
        }
      }

Is this somehow possible?

Kind regards
michael

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On December 16, 2019 11:11 AM UTC

Hi Michael,  

Using the queryCellInfo event, you can check the column-wise or cell-wise data whereas the rowDataBound event cannot make this happen. However you can loop through the cells of the row in the rowdDataBound event and programmatically collect the data related to the columns. Refer to the following code example.  

  methods: { 
    rowDataBound: function(args) { 
      var cols = this.$refs.grid.getColumns().filter((e)=>e.type==='boolean'); 
      for(var c = 0; c < cols.length; c++) { 
        if (isNullOrUndefined(args.data[cols[c].field])) { 
          var inx = this.$refs.grid.getColumnIndexByUid(cols[c].uid); 
          args.row.querySelector("td[aria-colindex='"+ inx +"']").innerHTML = null; 
        } 
      } 
    } 
  } 



Regards,  
Seeni Sakthi Kumar S

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon