DataTable Editor: Pre-Loaded data ok?

DataTable Editor: Pre-Loaded data ok?

Dave MDave M Posts: 7Questions: 0Answers: 0

Doing a trial on the inline editor. A general question at this point....

I'm starting with my DataTable table already loaded with data and now looking to add inline editting. All looks good but no luck implementing the inline editor.

Am I forced to use the same ajax call logic to initially load the table as per the javascript example (ie ajax staff.php) or can I already have table loaded and simply define the columns, select and buttons?

Stuck with the following error:

DataTables warning: table id=table - Cannont reintialise DataTable. For more information about this error, please see http://datatables.net.tn/3.

Thanks

Replies

  • kthorngrenkthorngren Posts: 20,276Questions: 26Answers: 4,765

    The error you are getting is not related to inline editing. The problem is you are trying to reinitialize an already initialized Datatable. Follow the tech note to learn more and to resolve the issue.

    The Editor should use the ajax option you configure to the Editor independent of how Datatables table is populated.

    Please post your code or better a link to your page if you require troubleshooting help.

    Kevin

  • Dave MDave M Posts: 7Questions: 0Answers: 0

    Ok that was it with the re-intializing. Thanks Kevin! I'll deal with the actual ajax updating once I can get the inline editting working.

    Currently I get the 'Uncaught Unable to automatically determine field from source' error message. Read the info at https://datatables.net/tn/11 over and over again. Couldn't figure out the issue.

    Here is where I am currently at... http://www.campadk.com/test/tables.php

    Thanks

  • kthorngrenkthorngren Posts: 20,276Questions: 26Answers: 4,765

    I think with that error you need to define the idSrc of the row:
    https://editor.datatables.net/reference/option/idSrc

    Looks like in your case you would use idSrc: "id".

    Kevin

  • Dave MDave M Posts: 7Questions: 0Answers: 0

    I added idSrc: "id". No difference.

  • kthorngrenkthorngren Posts: 20,276Questions: 26Answers: 4,765

    Not 100% sure on this but I think you may also need to define columns.data in your Datatables config. I believe the inline editor needs to match the field name to what is defined in columns.data. Since you don't have this defined the editor is not able to match with the Datatable. You can define this using DOM based data.

    Kevin

  • Dave MDave M Posts: 7Questions: 0Answers: 0

    Yup thats it! Should be good to get the rest working from here to test things out. Thanks Kevin!

This discussion has been closed.