Hello All,
I am new to development. I need help with the following.
There are two web pages that will be using the export to excel code and this is kept in a single .js file. The problem here is, the number of columns is not the same in both of these web pages. In one of the page, there are 7 columns. In the other page, there are 3 columns. Additionally, I also do not need the first column to be exported from both the pages.
Below is the function used to initialize datatable
$.fn.createDataTable = function (columns, ajaxOptions, order, initComplete = null)
Below is the function that I want to use for export to excel button:
buttons: [
{
extend: 'excelHtml5',
text: '<i class="btn_excel"></i> <span class=btn_text_align>Export to Excel</span>',
className: 'btn-sm btn_size',
titleAttr: 'Export to Excel',
exportOptions: {
Now I want to modify the main function createDataTable in the .js file to take columns and adjust the logic accordingly on pages that uses it so that the export to excel button works in both the pages correctly.
I am not sure what logic i need to use to achieve this requirement. If you are looking to help me on this, request you to provide me a full solution so that I can adjust any minor things to suit my code.
Thank you
Regards
Rajagopallan