Unknown Error when trying to export pdf with date range applied

Unknown Error when trying to export pdf with date range applied

nportnport Posts: 23Questions: 6Answers: 0

http://live.datatables.net/topuhayo/4/edit

I have a datatable with a date filter that is exporting reports with the date range displayed in the messageTop. I am getting the error:
"TypeError: Cannot read properties of undefined (reading '5')

When I try and select a date range and then press the pdf button (if there is no date range applied the error does not occur, as you can see in the test link)

It seems to be caused by the customize() function for the pdf in which I right align the 5th column (the salaries) but I am confused why this error is only occurring when a date range filter is applied.

How would I go about solving this, I am completely lost.

Replies

  • kthorngrenkthorngren Posts: 21,351Questions: 26Answers: 4,955

    This statement is the problem:

    var rowCount = table.rows().count() + 1;
    

    It will always be 58 in this test case. Use the row-selector of {search: "applied"} to get the proper row count. Like this:
    http://live.datatables.net/topuhayo/5/edit

    Kevin

  • nportnport Posts: 23Questions: 6Answers: 0

    @kthorngren okay that works thank you so much.

    This is semi-related but if you think I should open a different question I can do that but I also have an issue with the date range filter where if I put in the exact date no records will appear. For example my test link if you filter starting August 11th 2013 nothing appears but there should be at least one record there with that date that should appear

  • kthorngrenkthorngren Posts: 21,351Questions: 26Answers: 4,955

    It probably has something to do with the search plugin you are using. See this date range plugin. Your plugin checks for null where the date range plugin checks for empty strings. You probably need to do the same and check for empty strings.

    In the future new questions should have new threads. Mostly for others to find the answers later. Not a big deal this time though :smile:

    Kevin

  • nportnport Posts: 23Questions: 6Answers: 0

    @kthorngren okay I will check that out, thank you for the help I really appreciate it.

  • nportnport Posts: 23Questions: 6Answers: 0

    @kthorngren I will open a new question for the date range filter, also why is this thread not giving me the option to accept your answer?

  • kthorngrenkthorngren Posts: 21,351Questions: 26Answers: 4,955

    If you use the Ask a Question button you can accept the answer. Using the New Discussion button doesn't provide that option.

    Kevin

Sign In or Register to comment.