Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82130

Cannot get aocolums to work

$
0
0
Every time I enable aocolums the data goes away. I have tried both aocolumns and aocolumndefs.


students_array.php
include( "lib/DataTables.php" );

// Alias Editor classes so they are easy to use
use
	DataTables\Editor,
	DataTables\Editor\Field,
	DataTables\Editor\Format,
	DataTables\Editor\Join,
	DataTables\Editor\Validate;

// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'icdm_members' )
	->fields(
		Field::inst( 'usr', 0)->validator( 'Validate::required' ),
		Field::inst( 'email', 1 )->validator( 'Validate::required' ),
		Field::inst( 'regIP', 2 ),
		Field::inst( 'auth_level', 3 )->validator( 'Validate::required' )
	)
	->process( $_POST )
	->json();

Javascript
$(document).ready(function() {
$('#example').dataTable( {
		/*"sDom": "Tfrtip",*/
		"sAjaxSource": "php/students_array.php"
		"aoColumns": [
		  { "mData": "usr" },
                   { "mData": "email" },
                     { "mData": "regIP" },
	{ "mData": "auth_level" }

	} );
			} );



HTML

<div id="demo">
  <a href="" class="editor_create">Create new record</a>
  <table cellpadding="0" cellspacing="0" border="0" class="display" id="example" width="100%">
    <thead>
	<tr>
          <th>User</th>
	  <th>email</th>
	  <th>regIP</th>
	  <th>auth_level</th>
        </tr>
    </thead>	
  </table>
</div>

Viewing all articles
Browse latest Browse all 82130

Trending Articles