Cannot get aocolums to work

Cannot get aocolums to work

wbaconwbacon Posts: 5Questions: 0Answers: 0
edited January 2013 in DataTables 1.9
Every time I enable aocolums the data goes away. I have tried both aocolumns and aocolumndefs.


students_array.php
[code]
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();
[/code]

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

} );
} );

[/code]


HTML
[code]


Create new record



User
email
regIP
auth_level




[/code]

Replies

  • wbaconwbacon Posts: 5Questions: 0Answers: 0
    http://debug.datatables.net/uqares
  • wbaconwbacon Posts: 5Questions: 0Answers: 0
    retried using a variety of methods--

    Here is what I have now:

    http://debug.datatables.net/ehawow


    html
    [code]
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">




    DataTables Editor example


    @import "css/demo_page.css";
    @import "css/jquery.dataTables.css";
    @import "css/dataTables.tabletools.css";
    @import "css/dataTables.editor.css";




    <!----->






    DataTables Editor





    User
    Email
    IP address
    Date
    Authority
    Admin








    [/code]

    javascript
    [code]
    (function($){

    $(document).ready(function() {
    var editor = new $.fn.dataTable.Editor( {
    "ajaxUrl": "php/table.icdm_members.php",
    "domTable": "#icdm_members",
    "fields": [
    {
    "label": "User",
    "name": "usr",
    "type": "text"
    },
    {
    "label": "Email",
    "name": "email",
    "type": "text"
    },
    {
    "label": "IP address",
    "name": "regIP",
    "type": "text"
    },
    {
    "label": "Date",
    "name": "dt",
    "type": "text"
    },
    {
    "label": "Authority",
    "name": "auth_level",
    "type": "radio",
    "ipOpts": [
    {
    "label": "1",
    "value": "1"
    },
    {
    "label": "2",
    "value": "2"
    },
    {
    "label": "3",
    "value": "3"
    }
    ]
    }
    ]
    } );



    // New record
    $('a.editor_create').on('click', function (e) {
    e.preventDefault();

    editor.create(
    'Create new record',
    { "label": "Add", "fn": function () { editor.submit() } }
    );
    } );

    // Edit record
    $('#example').on('click', 'a.editor_edit', function (e) {
    e.preventDefault();

    editor.edit(
    $(this).parents('tr')[0],
    'Edit record',
    { "label": "Update", "fn": function () { editor.submit() } }
    );
    } );

    // Delete a record (without asking a user for confirmation)
    $('#example').on('click', 'a.editor_remove', function (e) {
    e.preventDefault();

    editor.remove( $(this).parents('tr')[0], '123', false, false );
    editor.submit();
    } );

    $('#icdm_members').dataTable( {
    "sDom": "Tfrtip",
    "sAjaxSource": "php/table.icdm_members.php",
    "aoColumns": [
    {
    "mData": "usr"
    },
    {
    "mData": "email"
    },
    {
    "mData": "regIP"
    },
    {
    "mData": "dt"
    },
    {
    "mData": "auth_level"
    },
    {
    "mData": null,
    "sClass": "center",
    "sDefaultContent": 'Edit / Delete'
    }
    ]

    } );
    } );

    }(jQuery));
    [/code]


    php
    [code]



    // DataTables PHP library
    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' )
    ->validator( 'Validate::required' ),
    Field::inst( 'email' )
    ->validator( 'Validate::email' ),
    Field::inst( 'regIP' )
    ->validator( 'Validate::ip' ),
    Field::inst( 'dt' ),
    Field::inst( 'auth_level' )
    ->validator( 'Validate::required' )
    )
    ->process( $_POST )
    ->json();

    [/code]
  • wbaconwbacon Posts: 5Questions: 0Answers: 0
    I n my last method I am getting rows however I cannot get the inline editors to function
  • wbaconwbacon Posts: 5Questions: 0Answers: 0
    I got it figured out. I had a link in the files to the wrong javascript file
This discussion has been closed.