Inline editing and tag fields

Inline editing and tag fields

dte1dte1 Posts: 6Questions: 2Answers: 0

Hi Allan,

I'll continue here (from https://datatables.net/forums/discussion/81422/date-picker-with-jquery-ui
).

When I use inline editing for tag fields and clicking on 'Add' expands the selection list. As soon as I select an entry from the list, the tag editor disappears without saving the new value.

I extended the tags-multiple example with added "keytable".

Here is the code:

var editor = new DataTable.Editor({ ajax: '../../controllers/joinArray.php', fields: [ { label: 'First name:', name: 'users.first_name' }, { label: 'Last name:', name: 'users.last_name' }, { label: 'Site:', name: 'users.site', type: 'select' }, { label: 'Permissions:', name: 'permission[].id', type: 'tags', limit: 4 } ], table: '#example' }); $('#example').DataTable({ ajax: { url: '../../controllers/joinArray.php', type: 'POST' }, columns: [ { data: 'users.first_name' }, { data: 'users.last_name' }, { data: 'sites.name' }, { data: 'permission', render: '[, ].name', editField: 'permission[].id'} ], keys: { columns: [0,1,3], editor: editor }, layout: { topStart: { buttons: [ { extend: 'create', editor: editor }, { extend: 'edit', editor: editor }, { extend: 'remove', editor: editor } ] } }, select: true }); 

best regards
Ilja

Replies

  • allanallan Posts: 65,350Questions: 1Answers: 10,842 Site admin

    Hi Ilja,

    You can continue in the old thread if you want - I'd see it just the same.

    I'm seeing some similar issues in this example if I pop open the console and run:

    var table = $('#example').DataTable().on('click', 'tbody td:last-child', function (e) { table.editor().inline(this, 'permission[].id'); }); 

    I'll need to look into that - it will need a change in Editor.

    Thanks,
    Allan

  • dte1dte1 Posts: 6Questions: 2Answers: 0

    Hi Allan,

    when I enter your lines of code, I can at least select entries from the list, which are then also transferred into the field. Only saving is not possible afterwards.

    Without your lines, the list closes without the selected value being applied. It feels as if the field simply loses focus.

    Thank you very much for your work on Datatables and your truly commendable support!

    best regards,
    Ilja

Sign In or Register to comment.