Search code examples
tabulator

formatting columns group Pdf tabulator


when I try to download a table with grouping by fields, it does not appear correctly in the pdf, can anyone help me? çenter image description here

enter image description here


Solution

  • Are you referring to the null values appearing in the output. If so then you can use an accessor on the column definitions to convert the null value into an empty string so it renders correctly.

    To start with we define an accessor function outside of Tabulator:

    var nullFixingAccessor = function(value){
        return value === null ? "" : value; //return value or empty string if it is null
    }
    

    Then in each column definition for a column that might contain a null we set it on the accessorDownload property:

    {title:"Act", field:"act", accessorDownload:nullFixingAccessor},
    

    This will then convert the null values to an empty string when the pdf is downloaded