Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Mar 2010
    Posts
    40
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Data Tables - multiple options not working

    Hi,

    Real noob here!

    Can anyone see why the following Data Tables jQuery code does not work. I'm trying to get the tables to show 50 records AND save state but can't seem to get both working at the same time. Thanks:

    Code:
    $(document).ready(function() {
    
    	$('#data-table').dataTable( {
            "iDisplayLength": 50
             "bStateSave": true
             } );
    	
    } );
    I've tried commas like this but still no good:

    Code:
    $(document).ready(function() {
    
    	$('#data-table').dataTable( {
            "iDisplayLength": 50,
             "bStateSave": true
             } );
    	
    } );
    Any help appreciated

  • #2
    New Coder
    Join Date
    Jul 2011
    Location
    Chennai, India
    Posts
    23
    Thanks
    0
    Thanked 5 Times in 5 Posts
    For me, second one seems to be correct. "Data source" is the only missing thing. It'll work for sure.

    Please make sure that the following are done:
    Did you included the datatable.js?
    Did you prepared the table layout properly for the datatable?
    Is your datasource is JSON?


    Still not working, let me know. I'll give an working example.

  • #3
    New Coder
    Join Date
    Mar 2010
    Posts
    40
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Hi,

    I've included all the files in the right places.

    Here is what I am currently using (I've added a couple of other options as you can se). I've commented out the first option as it breaks the code when I uncomment.

    Code:
    <script type="text/javascript" charset="utf-8" src="/includes/DataTables/media/js/jquery.js"></script>
    <script type="text/javascript" charset="utf-8" src="/includes/DataTables/media/js/jquery.dataTables.js"></script>
    <style type="text/css" title="currentStyle">
        @import "/includes/DataTables/media/css/demo_table.css";
    </style>
    <script type="text/javascript" charset="utf-8">
    $(document).ready(function() {
    
    	$('#data-table').dataTable( {
           // "iDisplayLength": 50,
    	"bStateSave": true,
            "sScrollX": "980px",
            "sScrollXInner": "150%",
            "bScrollCollapse": true		
        } );
    	
    } );
    </script>

  • #4
    New Coder
    Join Date
    Jul 2011
    Location
    Chennai, India
    Posts
    23
    Thanks
    0
    Thanked 5 Times in 5 Posts
    Hi Jock,

    Still I cannot able to find any issues in the posted code.
    Please through the attached example, it may help you. [design isn't up to the mark because I made it in kinda hurry]

    Apologize me for the late reply.
    Attached Files Attached Files

  • #5
    New Coder
    Join Date
    Mar 2010
    Posts
    40
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Thanks for replying.

    The code seems to be working now. I was using a CDN so possibly some delay in seeing the changes?

    Case closed!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •