Uncaught TypeError: Cannot read property 'aoColumns' of undefined

Uncaught TypeError: Cannot read property 'aoColumns' of undefined

jonescwjonescw Posts: 14Questions: 4Answers: 0
edited July 2015 in Editor

Using editor for the first time.

debug codes ihesem - before trying editor; opocoj after editor failed

link http://pcsnewyork.com/login/admin/configedit.php

Took the simple inline editing example and changed it to one of my tables and keep getting 2 error

when I try inline editing I get the following
Uncaught TypeError: Cannot read property 'aoColumns' of undefined

when I try selecting a row and select edit I get the following
Uncaught TypeError: Cannot read property 'PARAMETER' of undefined
where PARAMETER is the first field in my table.

the json file

{"data":[{"DT_RowId":"row_1","PARAMETER":"ADMIN_EMAIL","VALUE":"jonescw@comcast.net","DESC":"Email address of the Admin who should receive an email.\nTo add more the one email just separate the email address with a comma.\n"},{"DT_RowId":"row_2","PARAMETER":"DOMAIN","VALUE":"pcsnewyork.com","DESC":"Web site domain name"},{"DT_RowId":"row_3","PARAMETER":"EMPLOYEE_NOPASSWD","VALUE":"1","DESC":null},{"DT_RowId":"row_4","PARAMETER":"errorLevel","VALUE":"5","DESC":"Error reporting level"},{"DT_RowId":"row_5","PARAMETER":"errorLeveleMail","VALUE":"1","DESC":"error level to trigger an email sent"},{"DT_RowId":"row_6","PARAMETER":"IP_LOGIN","VALUE":"0","DESC":null},{"DT_RowId":"row_7","PARAMETER":"IP_LOGIN_LOCK","VALUE":"0","DESC":null},{"DT_RowId":"row_8","PARAMETER":"LOCKEDOUT_PERIOD","VALUE":"3600","DESC":"Number of seconds a member account is locked because of to many login attempts"},{"DT_RowId":"row_9","PARAMETER":"MIN_ROLEID_NOPWD","VALUE":"100","DESC":null},{"DT_RowId":"row_10","PARAMETER":"PATH","VALUE":"\/","DESC":"Path to the home directory for the website from public_html"},{"DT_RowId":"row_11","PARAMETER":"PRODUCTION_DOMAIN","VALUE":"pcsnewyork.com","DESC":"The production domain name"},{"DT_RowId":"row_12","PARAMETER":"PRODUCTION_HOME_DIR","VALUE":"researchWeb","DESC":"Home directory of the production webpages."},{"DT_RowId":"row_13","PARAMETER":"PWD_RESET_TIMEOUT","VALUE":"10800","DESC":null},{"DT_RowId":"row_14","PARAMETER":"RETRY_COUNT","VALUE":"5","DESC":"Number of login tries in a row before a good login a member can try before their account is locked. "},{"DT_RowId":"row_15","PARAMETER":"RETRY_MAX","VALUE":"100","DESC":"Max number of login or login retries a member can do in an hour before the members account is locked."},{"DT_RowId":"row_16","PARAMETER":"RETRY_PERIOD","VALUE":"3600","DESC":"Number of seconds an account is lock because of to many login attempts."},{"DT_RowId":"row_17","PARAMETER":"SEND_ADMIN_EMAIL","VALUE":"2","DESC":null},{"DT_RowId":"row_18","PARAMETER":"SIMULT_LOGIN","VALUE":"3","DESC":"The number of concert login a member can have. "},{"DT_RowId":"row_19","PARAMETER":"SITE_NAME","VALUE":"Pacific Crest Hub ResearchWeb","DESC":"Name of the site. Displayed on the log in web page and as the tab name."},{"DT_RowId":"row_20","PARAMETER":"SYSTEM_LOCKDOWN","VALUE":"0","DESC":null},{"DT_RowId":"row_21","PARAMETER":"TEST","VALUE":"1","DESC":"Is this a production(0) or test(1) environment"}],"options":[]}

javascript

var editor; // use a global for the submit and return data rendering in the examples

$(document).ready(function() {
   editor = new $.fn.dataTable.Editor( {
      ajax: "/../../login/mysql/configDB.php", 
      table: "#benjiw_researchWeb.CONFIG",
      fields: [ {
            label: "PARAMETER:",
            name: "PARAMETER"
         }, {
            label: "VALUE:",
            name: "VALUE"
         }, {
            label: "DESC:", 
            name: "DESC"
         }
      ]
   } );

   // Activate an inline edit on click of a table cell
   $('#example').on( 'click', 'tbody td:not(:first-child)', function (e) {
      editor.inline( this );
   } );

   $('#example').DataTable( {
      dom: "Tfrtip",
      ajax: "/../../login/mysql/configDB.php",
      columns: [
         { data: null, defaultContent: '', orderable: false },
         { data: "PARAMETER" },
         { data: "VALUE" },
         { data: "DESC" }
      ],
      order: [ 1, 'asc' ],
      tableTools: {
         sRowSelect: "os",
         sRowSelector: 'td:first-child',
         aButtons: [
            { sExtends: "editor_create", editor: editor },
            { sExtends: "editor_edit",   editor: editor },
            { sExtends: "editor_remove", editor: editor }
         ]
      }
   } );
} );

html

         <table id="example" class="display" cellspacing="0" width="100%">
            <thead>
               <tr>
                  <th></th>

                  <th>PARAMETER</th>  
                  <th>VALUE</th>
                  <th>DESC</th>
               </tr>
            </thead>
         </table>

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,667Questions: 1Answers: 10,096 Site admin
    Answer ✓

    Hi,

    The issue is this line:

    table: "benjiw_researchWeb.CONFIG",

    It should just be:

    table: "example",
    

    in this case. The table parameter tells Editor what HTML table it is to operate with - rather than what database table.

    Regards,
    Allan

This discussion has been closed.