configuration
configuration
Could I do something like this? Say I already have a table #myTable that's fulled.
`var editor = new $.fn.dataTable.Editor( {
table: '#myTable',
fields: [
{ label: 'First name', name: 'first_name' },
{ label: 'Last name', name: 'last_name' },
// etc
]
} );
$('#myTable').DataTable( {
dom: 'Bfrtip',
columns: [
{ data: 'first_name' },
{ data: 'last_name' },
// etc
],
select: true,
buttons: [
{ extend: 'create', editor: editor },
{ extend: 'edit', editor: editor },
{ extend: 'remove', editor: editor }
]
} );`
I know you can do $('#myTable').DataTable(); and it will target it. But I wanted to use the editor.
This question has accepted answers - jump to:
Answers
Looks like it should work. You probably already know this but you will also need to load the Buttons, Select and Editor CSS and JS files.
Are you having issues with this config?
Kevin
Not sure if you can see this. But it's not working on the live
http://live.datatables.net/cozuhomi/5
Hi @54696d20 Tim,
I'm not entirely sure what you're trying to do, but the reason why your example wasn't working was because the libraries weren't loading. This here is using the table selectors as you were, and is behaving,
Cheers,
Colin
Thanks @colin .
I'm just trying to use DT in a different way. My current system is using WebForms .Net 4.0. Currently DT will only compile with 4.5. So I figured if I populate a html table with a different Ajax request. I could still use DT for the table. Unfortunately, even with your example I'm still not able to add checkboxes on the first column. It's probably something that I'm over looking
https://editor.datatables.net/examples/inline-editing/simple.html
Hi @54696d20 ,
This is with the checkboxes. I added a column in the HTML, and the column in
columns
. Mine is slightly artificial because the data is in the DOM, but that should be all you need.If you could link to your page we're happy to take a look,
Cheers,
Colin
Hey @colin
Thanks. I see what I was doing wrong.