#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2011
    Posts
    33
    Rep Power
    4

    DataTables with Jquery issues.


    I have done html/javascript for a little while but never used Jquery for whatever reason and cant seem to get these datatables to work. This is a simple example I mocked up from a tutorial but it does nothing. Any help as to what I did wrong?
    Code:
    <html>
    	<head>
    		<script type="text/javascript" charset="utf-8" src="/DataTables/media/js/jquery.js"></script>
    		<script type="text/javascript" charset="utf-8" src="/DataTables/media/js/jquery.dataTables.js"></script>
    		<script>
    			$(document).ready( function () {
    				$('#table_id').dataTable();
    			} );
    		</script>
    		<style type="text/css" title="currentStyle">
    			@import "/DataTables/media/css/demo_table.css";
    		</style>
    	</head>
    	<body>
    		<table id="table_id" class="display">
    			<thead>
    				<tr>
    					<th>Column 1</th>
    					<th>Column 2</th>
    				</tr>
    			</thead>
    			<tbody>
    				<tr>
    					<td>Row 1 Data 1</td>
    					<td>Row 1 Data 2</td>
    				</tr>
    				<tr>
    					<td>Row 2 Data 1</td>
    					<td>Row 2 Data 2</td>
    				</tr>
    			</tbody>
    		</table>
    	</body>
    </html>
  2. #2
  3. A Not To Shabby Code Smurf
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2008
    Posts
    1,158
    Rep Power
    184
    Here is a basic example; derived from: http://jquery-datatables-column-filt...unk/index.html and you should be able to get a basic idea from this:
    Code:
    <!doctype html>
    <html>
    <head>
    <meta charset="UTF-8"/>
    
    	<title>Example of jQuery dataTable() Plug-In</title>
    
    <style>
    #example {
    width:980px;
    }
    #example_paginate {
    margin-top:25px;
    font-family:arial;
    }
    a.ui-button, a.ui-button:link, a.ui-button:visited {
    margin-left:15px;
    border:solid 1px black;
    color:white;
    background:black;
    padding:5px;
    text-align:center;
    }
    a.ui-button:hover, a.ui-button:active {
    margin-left:15px;
    border:solid 1px black;
    color:black;
    background:white;
    padding:5px;
    text-align:center;
    cursor:pointer;
    }
    a.ui-state-disabled, a.ui-state-disabled:link, a.ui-state-disabled:visited, a.ui-state-disabled:hover, a.ui-state-disabled:active {
    margin-left:15px;
    border:solid 1px black;
    color:white;
    background:red;
    padding:5px;
    text-align:center;
    cursor:pointer;
    }
    table {
    border-collapse:collapse;
    border:solid 1px black;
    margin-top:25px;
    }
    td {
    border:solid 1px black;
    padding:10px;
    }
    th {
    padding:10px;
    }
    </style>
    
    <script type="text/javascript" src="http://jquery-datatables-column-filter.googlecode.com/svn/trunk/media/js/complete.js"></script>
    		<script src="http://jquery-datatables-column-filter.googlecode.com/svn/trunk/media/js/jquery-1.4.4.min.js" type="text/javascript"></script>
            	<script src="http://jquery-datatables-column-filter.googlecode.com/svn/trunk/media/js/jquery.dataTables.js" type="text/javascript"></script>
    		<script type="text/javascript" src="http://jquery-datatables-column-filter.googlecode.com/svn/trunk/media/js/jquery.dataTables.columnFilter.js"></script>
    		<script type="text/javascript">
    $(document).ready(function(){
         $('#example').dataTable({
                 bJQueryUI: true,
    			 "sPaginationType": "full_numbers"
    })
    		  .columnFilter({
    			aoColumns: [ { type: "select", values: [ 'Gecko', 'Trident', 'KHTML', 'Misc', 'Presto', 'Webkit', 'Tasman']  },
    				     { type: "text" },
    				     null,
    				     { type: "number" },
    				     { type: "select", values: [ 'A', 'C', 'U', 'X']  }
    				]
    
    		});
    });
    
    </script>
    
    </head>
    <body>
    
    <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
    	<thead>
    		<tr>
    			<th>Rendering engine</th>
    
    			<th>Browser</th>
    			<th>Platform(s)</th>
    			<th>Engine version</th>
    			<th>CSS grade</th>
    		</tr>
    	</thead>
    	<tfoot>
    		<tr>
    			<th>Rendering engine</th>
    
    			<th>Browser</th>
    			<th>Platform(s)</th>
    			<th>Engine version</th>
    			<th>CSS grade</th>
    		</tr>
    	</tfoot>
    	<tbody>
    
    		<tr class="gradeX">
    			<td>Trident</td>
    			<td>Internet
    				 Explorer 4.0</td>
    			<td>Win 95+</td>
    			<td class="center">4</td>
    			<td class="center">X</td>
    
    		</tr>
    		<tr class="gradeC">
    			<td>Trident</td>
    			<td>Internet
    				 Explorer 5.0</td>
    			<td>Win 95+</td>
    			<td class="center">5</td>
    			<td class="center">C</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Trident</td>
    			<td>Internet
    				 Explorer 5.5</td>
    			<td>Win 95+</td>
    			<td class="center">5.5</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Trident</td>
    			<td>Internet
    				 Explorer 6</td>
    			<td>Win 98+</td>
    			<td class="center">6</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Trident</td>
    			<td>Internet Explorer 7</td>
    			<td>Win XP SP2+</td>
    			<td class="center">7</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Trident</td>
    			<td>AOL browser (AOL desktop)</td>
    			<td>Win XP</td>
    			<td class="center">6</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Firefox 1.0</td>
    			<td>Win 98+ / OSX.2+</td>
    			<td class="center">1.7</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Firefox 1.5</td>
    			<td>Win 98+ / OSX.2+</td>
    			<td class="center">1.8</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Firefox 2.0</td>
    			<td>Win 98+ / OSX.2+</td>
    			<td class="center">1.8</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Firefox 3.0</td>
    			<td>Win 2k+ / OSX.3+</td>
    			<td class="center">1.9</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Camino 1.0</td>
    			<td>OSX.2+</td>
    			<td class="center">1.8</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Camino 1.5</td>
    			<td>OSX.3+</td>
    			<td class="center">1.8</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Netscape 7.2</td>
    			<td>Win 95+ / Mac OS 8.6-9.2</td>
    			<td class="center">1.7</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Netscape Browser 8</td>
    			<td>Win 98SE+</td>
    			<td class="center">1.7</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Netscape Navigator 9</td>
    			<td>Win 98+ / OSX.2+</td>
    			<td class="center">1.8</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Mozilla 1.0</td>
    			<td>Win 95+ / OSX.1+</td>
    			<td class="center">1</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Mozilla 1.1</td>
    			<td>Win 95+ / OSX.1+</td>
    			<td class="center">1.1</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Mozilla 1.2</td>
    			<td>Win 95+ / OSX.1+</td>
    			<td class="center">1.2</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Mozilla 1.3</td>
    			<td>Win 95+ / OSX.1+</td>
    			<td class="center">1.3</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Mozilla 1.4</td>
    			<td>Win 95+ / OSX.1+</td>
    			<td class="center">1.4</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Mozilla 1.5</td>
    			<td>Win 95+ / OSX.1+</td>
    			<td class="center">1.5</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Mozilla 1.6</td>
    			<td>Win 95+ / OSX.1+</td>
    			<td class="center">1.6</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Mozilla 1.7</td>
    			<td>Win 98+ / OSX.1+</td>
    			<td class="center">1.7</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Mozilla 1.8</td>
    			<td>Win 98+ / OSX.1+</td>
    			<td class="center">1.8</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Seamonkey 1.1</td>
    			<td>Win 98+ / OSX.2+</td>
    			<td class="center">1.8</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Gecko</td>
    			<td>Epiphany 2.20</td>
    			<td>Gnome</td>
    			<td class="center">1.8</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Webkit</td>
    			<td>Safari 1.2</td>
    			<td>OSX.3</td>
    			<td class="center">125.5</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Webkit</td>
    			<td>Safari 1.3</td>
    			<td>OSX.3</td>
    			<td class="center">312.8</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Webkit</td>
    			<td>Safari 2.0</td>
    			<td>OSX.4+</td>
    			<td class="center">419.3</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Webkit</td>
    			<td>Safari 3.0</td>
    			<td>OSX.4+</td>
    			<td class="center">522.1</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Webkit</td>
    			<td>Google Chrome 1.0</td>
    			<td>Win XP+</td>
    			<td class="center">525</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Webkit</td>
    			<td>OmniWeb 5.5</td>
    			<td>OSX.4+</td>
    			<td class="center">420</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Webkit</td>
    			<td>iPod Touch / iPhone</td>
    			<td>iPod</td>
    			<td class="center">420.1</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Webkit</td>
    			<td>S60</td>
    			<td>S60</td>
    			<td class="center">413</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Presto</td>
    			<td>Opera 7.0</td>
    			<td>Win 95+ / OSX.1+</td>
    			<td class="center">-</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Presto</td>
    			<td>Opera 7.5</td>
    			<td>Win 95+ / OSX.2+</td>
    			<td class="center">-</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Presto</td>
    			<td>Opera 8.0</td>
    			<td>Win 95+ / OSX.2+</td>
    			<td class="center">-</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Presto</td>
    			<td>Opera 8.5</td>
    			<td>Win 95+ / OSX.2+</td>
    			<td class="center">-</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Presto</td>
    			<td>Opera 9.0</td>
    			<td>Win 95+ / OSX.3+</td>
    			<td class="center">-</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Presto</td>
    			<td>Opera 9.2</td>
    			<td>Win 88+ / OSX.3+</td>
    			<td class="center">-</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Presto</td>
    			<td>Opera 9.5</td>
    			<td>Win 88+ / OSX.3+</td>
    			<td class="center">-</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Presto</td>
    			<td>Opera for Wii</td>
    			<td>Wii</td>
    			<td class="center">-</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Presto</td>
    			<td>Nokia N800</td>
    			<td>N800</td>
    			<td class="center">-</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Presto</td>
    			<td>Nintendo DS browser</td>
    			<td>Nintendo DS</td>
    			<td class="center">8.5</td>
    			<td class="center">C/A<sup>1</sup></td>
    
    		</tr>
    		<tr class="gradeC">
    			<td>KHTML</td>
    			<td>Konqureror 3.1</td>
    			<td>KDE 3.1</td>
    			<td class="center">3.1</td>
    			<td class="center">C</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>KHTML</td>
    			<td>Konqureror 3.3</td>
    			<td>KDE 3.3</td>
    			<td class="center">3.3</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>KHTML</td>
    			<td>Konqureror 3.5</td>
    			<td>KDE 3.5</td>
    			<td class="center">3.5</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeX">
    			<td>Tasman</td>
    			<td>Internet Explorer 4.5</td>
    			<td>Mac OS 8-9</td>
    			<td class="center">-</td>
    			<td class="center">X</td>
    
    		</tr>
    		<tr class="gradeC">
    			<td>Tasman</td>
    			<td>Internet Explorer 5.1</td>
    			<td>Mac OS 7.6-9</td>
    			<td class="center">1</td>
    			<td class="center">C</td>
    
    		</tr>
    		<tr class="gradeC">
    			<td>Tasman</td>
    			<td>Internet Explorer 5.2</td>
    			<td>Mac OS 8-X</td>
    			<td class="center">1</td>
    			<td class="center">C</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Misc</td>
    			<td>NetFront 3.1</td>
    			<td>Embedded devices</td>
    			<td class="center">-</td>
    			<td class="center">C</td>
    
    		</tr>
    		<tr class="gradeA">
    			<td>Misc</td>
    			<td>NetFront 3.4</td>
    			<td>Embedded devices</td>
    			<td class="center">-</td>
    			<td class="center">A</td>
    
    		</tr>
    		<tr class="gradeX">
    			<td>Misc</td>
    			<td>Dillo 0.8</td>
    			<td>Embedded devices</td>
    			<td class="center">-</td>
    			<td class="center">X</td>
    
    		</tr>
    		<tr class="gradeX">
    			<td>Misc</td>
    			<td>Links</td>
    			<td>Text only</td>
    			<td class="center">-</td>
    			<td class="center">X</td>
    
    		</tr>
    		<tr class="gradeX">
    			<td>Misc</td>
    			<td>Lynx</td>
    			<td>Text only</td>
    			<td class="center">-</td>
    			<td class="center">X</td>
    
    		</tr>
    		<tr class="gradeC">
    			<td>Misc</td>
    			<td>IE Mobile</td>
    			<td>Windows Mobile 6</td>
    			<td class="center">-</td>
    			<td class="center">C</td>
    
    		</tr>
    		<tr class="gradeC">
    			<td>Misc</td>
    			<td>PSP browser</td>
    			<td>PSP</td>
    			<td class="center">-</td>
    			<td class="center">C</td>
    
    		</tr>
    		<tr class="gradeU">
    			<td>Other browsers</td>
    			<td>All others</td>
    			<td>-</td>
    			<td class="center">-</td>
    			<td class="center">U</td>
    
    		</tr>
    	</tbody>
    </table>
    
    </body>
    </html>
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2011
    Posts
    33
    Rep Power
    4
    Awesome think you so much, couldnt get that started.

IMN logo majestic logo threadwatch logo seochat tools logo