ScrollX (horizontal scrolling) on old version?

ScrollX (horizontal scrolling) on old version?

kneidelskneidels Posts: 4Questions: 1Answers: 0

Hi there.

I have Datatables v1.9.1 (jquery 1.7.2) on an old system i have an and running (wary to upgrade, due to many dependencies)
and would like to use this code for containing an overly-wide table:

 $('#dataresult').dataTable({
                "scrollX": true
            });

it doesnt seem to be working, i am getting this error

TypeError: m is undefined - jquery.dataTables.min.js:27:51

Is this supposed to work on an old version? was there a different syntax then?

Thanks

Answers

  • kthorngrenkthorngren Posts: 21,341Questions: 26Answers: 4,954

    scrollX is the current form of the option for Datatables 1.10. You will need to use the Datatables 1.9 form of the option which is sScrollX. This Conversion Guide shows the mapping between 1.9 and 1.10.

    Since Datatables 1.10 is backward compatible I would suggest giving it a try. any issues found in 1.9 is likely not going to be fixed by the developers.

    Kevin

  • kneidelskneidels Posts: 4Questions: 1Answers: 0

    Thank you for the response :-)

    I tried the sScrollX option, but received the same error

    TypeError: m is undefined - jquery.dataTables.min.js:27:51

    Would you know what they might be indicative of?

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @kneidels ,

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • kneidelskneidels Posts: 4Questions: 1Answers: 0

    Hi @colin

    thanks for the reply and the good direction to give a test setup.
    here it is: http://live.datatables.net/tunulivi/1/
    using the live nightly.

    Thanks!

  • kthorngrenkthorngren Posts: 21,341Questions: 26Answers: 4,954
    edited May 2019

    Thanks for the example, it helps a lot to understand what you are doing. The problem is that Datatables doesn't support colspan in the tbody. You have this:

        <tbody>
        
                  <tr><td colspan="2" style="border-bottom: 1px solid #000;"><strong>Foundations</strong></td></tr>
    

    Move it into the thead and you should be good to go:
    http://live.datatables.net/yixeyahu/1/edit

    Here is an example using complex headers:
    https://datatables.net/examples/basic_init/complex_header.html

    Kevin

  • kneidelskneidels Posts: 4Questions: 1Answers: 0

    got it @kthorngren - thanks very much!

This discussion has been closed.