Excell export format HTML works only on first page

Excell export format HTML works only on first page

awariatawariat Posts: 8Questions: 4Answers: 0

In my cells I have Buttons and Inputs. I need values for Excel. The code below works but only for 1st page. How to make it working for all pages?

 format: {
          body: function (data, row, column, node) {
            // Check for button groups first
            const buttonGroups = $(node).find('.btn-group');
            if (buttonGroups.length) {
              // Process button groups
              return buttonGroups.map(function () {
                const primary = $(this).find('.btn-primary').text().trim(); // Get the primary button text
                const success = $(this).find('.btn-success').text().trim(); // Get the success button text
                return `${primary}:${success}`; // Combine the values with a colon
              }).get().join(', '); // Join multiple button groups with a comma
            }

            // Check for individual buttons
            const buttons = $(node).find('button');
            if (buttons.length) {
              return buttons.map(function () {
                return $(this).text().trim(); // Get the text of each button
              }).get().join(', '); // Join button values with a comma
            }

            const inputElement = $(node).find('input');
            if (inputElement.length) {
              return inputElement.val(); // Return the value of the input element
            }
            return data; // Otherwise, return the cell data as-is
          }
        }

      },

Answers

  • kthorngrenkthorngren Posts: 21,545Questions: 26Answers: 4,988

    Are you saying that only the current page is exported or that all pages are exported but only the current page's inputs are processed?

    If only the current page is exported and you have server side processing enabled see this FAQ.

    If the inputs on the current page are exported then please provide a link to a test case showing the issue so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

Sign In or Register to comment.