Edit Button Fails in Test Case / Bootstrap Tabs on Editor Form Template
Edit Button Fails in Test Case / Bootstrap Tabs on Editor Form Template
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
I got the Editor running:
http://live.datatables.net/vezigobe/1/edit
You were loading jquery twice.
You are getting this console error:
I added
idSrc
andcolumns.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:
Anyway the Editor button is now pulling up a form.
Kevin
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
I just used the browser's console.
Kevin
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