Incorrect header when exporting to PDF with yadcf filter

后端 未结 2 1901
一生所求
一生所求 2021-01-25 07:39

When I am trying to export to pdf my Datatable with a filter yadcf, the header show always every case from my filter, how can I hide that?

My javascript is :

         


        
相关标签:
2条回答
  • 2021-01-25 07:52

    Ok i did it, but i think it s very weird :

    exportOptions: { 
        columns: ':visible' , 
        format: { 
                  header: function ( data, column, row ) 
                    {
                      return data.substring(data.indexOf("inline-block")+15,data.indexOf("<span")); 
                    }
               }
        }
    

    I don't know if is it to me to patch that, or maybe there is a bug, but the point is that it works !

    0 讨论(0)
  • 2021-01-25 07:54

    I too faced this issue and I did something like below:-

    exportOptions: { 
    columns: ':visible' , 
    format: { 
              header: function ( data, column, row ) 
                {
                  return data.split('<')[0]; 
                }
           }
    }
    

    It worked for me. This will remove the div which is getting added. When I checked my header data was something like: -

    column name<div id="yadcf-filter-wrapper--crime_table-7" class="yadcf-filter-wrapper"><select id="yadcf-filter--crime_table-7" class="yadcf-filter " onchange="yadcf.doFilter(this, '-crime_table', 7, 'contains');" onkeydown="yadcf.preventDefaultForEnter(event);" onmousedown="yadcf.stopPropagation(event);" onclick="yadcf.stopPropagation(event);"><option value="-1">Select Column</option>............................<button type="button" id="yadcf-filter--crime_table-7-reset" onmousedown="yadcf.stopPropagation(event);

    So I split the div from the column name and kept just the header.

    0 讨论(0)
提交回复
热议问题