3

I have a really big columns, around 40 columns and want to scroll horizontally, but its not working.

$(document).ready(function () {
    $('#example').dataTable({
            "oTableTools": {
                           "sScrollY": 200,
                           "sScrollX": "200%",
                           "sScrollXInner": "110%"
             }
    });
});
10
  • 2
    missing closing }); Commented Aug 19, 2013 at 4:19
  • Sorry, posting mistake. Its not missing closing }); problem though. Commented Aug 19, 2013 at 4:37
  • this q/a might help you stackoverflow.com/questions/18049935/… Commented Aug 19, 2013 at 5:10
  • seems to be working jsfiddle.net/QS9pw Commented Aug 19, 2013 at 5:43
  • I want horizontal scroll bar like in this example, datatables.net/examples/basic_init/scroll_x.html scroll bar is coming for like a whole page not for table only. Commented Aug 19, 2013 at 6:22

2 Answers 2

6

Removing the scroll-x-inner might help.

"sScrollXInner": "110%"

It worked for me. Source datatables.net/forums

Sign up to request clarification or add additional context in comments.

Comments

0

the best solution is wrapping the target table with tag by jquery and creating an break line
tag to separate please see below sample code

            $('#target_table').wrap("<div id='tableData' style='\n\
                                        overflow: auto;\n\
                                        overflow-y: hidden;\n\
                                        -ms-overflow-y: hidden\n\
                                        position:relative;\n\
                                        margin-right:5px;\n\
                                        padding-bottom: 15px;\n\
                                        display:block;\n\
                                   '>/");; 

           $("#tableData").before("<br/><br/>");  

the problem is if your using sScrollX or scrollX is that not all datatables plugin version support this function and it depends also in jquery platform that we are using and not all browsers are supported like with the damn IE8,7 and 6.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.