Edit Button Fails in Test Case / Bootstrap Tabs on Editor Form Template

Edit Button Fails in Test Case / Bootstrap Tabs on Editor Form Template

enwoodenwood Posts: 5Questions: 2Answers: 0

Hi all,
I've been losing time rapidly trying to get Bootstrap Tabs operational on an Editor custom template.

In my own work, I've found that while I can get the tabs to display on the custom template, I cannot switch the tabs. An identical problem was identified by Brendons here:
https://datatables.net/forums/discussion/36270

So, I built a test case. But, despite basing the test case Examples from the editor.datatables.net site, I cannot get the "Edit" button to display the simple, custom form! It just triggers a "Script error" in the live.datatables.net console.
http://live.datatables.net/reyugama/6/edit

Allan, any idea what's tripping up the Edit button?

If I could get the Editor button, then I'd be able to demonstrate that the Bootstrap tab switching is not working.

This is all I did:

var editor; 
$(document).ready( function () {

  editor = new $.fn.dataTable.Editor(
      {
        table: '#example',
        template: '#customForm',
        fields: [
          { label: 'Name', name: 'name' },
          { label: 'Office', name: 'office'}
        ]
      }
  );  

  var table = $('#example').DataTable(
      {
        dom: 'Bfrtip',
        select: true,        
        buttons: [
            { extend: "edit",   editor: editor },
          ]
      }
    );

  
  } );

Thanks,
Tim

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,299Questions: 26Answers: 4,945
    edited May 2018 Answer ✓

    I got the Editor running:
    http://live.datatables.net/vezigobe/1/edit

    You were loading jquery twice.

    You are getting this console error:

    Uncaught Unable to find row identifier For more information, please refer to https://datatables.net/tn/14
    

    I added idSrc and columns.data to fix the row identifier.

    Not sure why you are loading these:
    editor.datatables.net/examples/resources/demo.js
    editor.datatables.net/examples/resources/editor-demo.js

    They are causing this error:

    Uncaught ReferenceError: SyntaxHighlighter is not defined
        at demo.js:3
    

    Anyway the Editor button is now pulling up a form.

    Kevin

  • enwoodenwood Posts: 5Questions: 2Answers: 0

    Kevin! Most excellent indeed! Yes, it seems I jury-rigged the example a little too much, I suppose, cutting and pasting from other examples on the site. I couldn't make it work with the initial live.datatables.net example and I guess it went downhill from there.

    Thanks so much for your attention! I was going in circles, and about to walk away from the tabs-on-the-template approach. Back from the brink, indeed.

    What did you debug this in? (The console within live.datatables.net wasn't giving me the level of errors you included.)

    Regards,
    Tim

  • kthorngrenkthorngren Posts: 21,299Questions: 26Answers: 4,945

    What did you debug this in? (The console within live.datatables.net wasn't giving me the level of errors you included.)

    I just used the browser's console.

    Kevin

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    The console tab on the live site isn't nearly as complete as the one built into browsers. Its only really useful for console.log lines, so typically I don't bother with it (I can't speak for Kevin, but I suspect he's the same!). Use the one in your browser - its also a lot faster.

    Allan

This discussion has been closed.