Pivot datasource - how to set empty dates ???

Hi,

We use the pivot table with a datasource that has dates data points. Sometimes these date values can be empty. Currently we generate the json datasource as follows ( the date field name is"f1346623" ):

Empty date have a value of "".

[
{
    "f1346623" : "06.15.2017",
    "f1" : 1
},
{
    "f1346623" : "06.01.2017",
    "f1" : 1
},
{
    "f1346623" : '',
    "f1" : 1
},
{
    "f1346623" : '',
    "f1" : 1
}
];

This creates a rendering problem in the pivot control. If the dataset has dates that are empty, the pivot grid does not render at all. If we filter out the empty dates then it will work. This also breaks the grouping function.

How can we set empty date values in our datasource so the pivot works correctly?

We tried setting the value to null , the rendering works but then it shows null in the grid which is NOT user friendly. We tried setting the emptyCellsTextContent property but null is still displayed.

You can see an example of this at http://www.tgmt-systems.com/syncFusion/index.jsp . It will not work by default but if you filter out the empty dates in the 'Due Date' field, it will work.

Looking forward to your reply.

5 Replies

MM Manikandan Murugesan Syncfusion Team February 28, 2022 11:40 AM UTC

Hi Thierry, 

Please set “null” or “undefined” to the empty dates. You can also hide those headers by using the "showHeaderWhenEmpty" property in the “dataSourceSettings”. Please refer the code example below. 
 
Code Example: 
var pivotObj = new ej.pivotview.PivotView({ 
  dataSourceSettings: { 
    showHeaderWhenEmpty: false, 
  } 
}); 
pivotObj.appendTo('#PivotView'); 
 
Meanwhile, we have prepared a sample for your reference. Please find it from below link. 
 
Please see the following UG document for more information on the "showHeaderWhenEmpty " property. 
 
Please let us know if you have any concerns. 
 
Regards,  
Manikandan 



TT Thierry Tremblay February 28, 2022 06:01 PM UTC

Thank you, that did help. I have a follow-up question.


Instead of hiding null - undefined values, would it be possible to show them has an empty string??


If so, how can this be done?


Thanks.



MM Manikandan Murugesan Syncfusion Team March 1, 2022 12:48 PM UTC

Hi Thierry, 

To display null headers as an empty string, use the localization option. Please refer the example code below. 
 
Code Example: 
var L10n = ej.base.L10n; 
L10n.load({ 
  'en-US': { 
    pivotview: { 
      null: '', 
    }, 
  }, 
}); 
 
Meanwhile, we have prepared a sample for your reference. Please find it from below link. 
 
Please see the following UG document for more information on the "localization " option. 
 
Please let us know if you have any concerns. 
 
Regards, 
Manikandan 



TT Thierry Tremblay March 1, 2022 07:29 PM UTC

This is perfect! Thank you very much 



MM Manikandan Murugesan Syncfusion Team March 2, 2022 11:34 AM UTC

Hi Thierry, 
 
Please let us know if you have any other queries. We are always happy to assist you. 
 
Regards, 
Manikandan 


Loader.
Up arrow icon