Standalone fields, using Node.JS and Parent-Child mySQL Tables

Standalone fields, using Node.JS and Parent-Child mySQL Tables

MarkAndersonUKMarkAndersonUK Posts: 44Questions: 17Answers: 0

My apologies if this is too vague a question, but I am hoping someone out there has an example that I can use
to apply to my own needs.

I have a table that contains a list of contacts, and I have another table that contains some information about those contacts.
What I picture in my mind is a grid that shows the contacts,that covers half the page, and when a contact is selected, it causes a form to populate some fields from the related child table., I suspect using the Standalone method might
be a great way to do this.

I have this working using two datatables currently, but I would much prefer to use one datatable/grid view, then a
standalone form for what is currently another datatable/grid view.

I tried using the example listed for an standalone 'inline' edit, but when I try and click to edit, all I get is an error in the browser console :

       ** dataTables.editor.js:2798 Uncaught TypeError: Cannot read properties of undefined (reading 'attach')**

Using the Standalone Edit function appears to work fine, just not the Inline mode. I used the examples listed as a template for my own. I strongly suspect the problem is with the use of ** 'this' ** in the line **r_dataEditor.inline( this, { **

        $('#editRD').on( 'click', function () {
            r_dataEditor
                .buttons( {
                    label: "Save",
                    fn: function () { this.submit(); }
                } )
                .edit();
        } );

        $('[data-editor-field]').on( 'click', function (e) {
            r_dataEditor.inline( this, {
                buttons: '_basic'
            } );
        } );

I have some other questions, that someone may be able to help with, or just send me an example to look at.

  1. How to get the 'initial' data values into the standalone fields, when the record is selected from the Parent table.
  2. How can I display Standalone fields using select, checkboxes, radio, etc I know how to do this in standard Edit Forms, but not sure how to apply it correctly when using the 'data-editor-field' in the HTML.

Any help, or examples would be really appreciated.

thanks

Answers

  • MarkAndersonUKMarkAndersonUK Posts: 44Questions: 17Answers: 0

    Hi, I was able to move past the initial error (Cannot read properties of undefined (reading 'attach'). However, I am still getting a lot of problems trying to get this to work. I have pulled out a log of code that just makes things look overly complex to try and show the actual issues more clearly. So as not to confuse anyone with this example, I request that this question be closed and I will repost with proper example code for the entire system. Thanks

This discussion has been closed.