Editor Datatable Field - Stand Alone not joined to a field and more

Editor Datatable Field - Stand Alone not joined to a field and more

paul@dmcreative.compaul@dmcreative.com Posts: 27Questions: 5Answers: 0

The datatable field is a wonderful addition to the editor and makes me more curious about all of the capabilities that are not fully apparent in the documentation.

1) Is it possible to include a datatable field type in an editor form that is not linked to a field that is part of a join. Use the table as a reference for the user to view - display only.
2) Under the config: section i see how to set paging for scrolling display, are all of the other options available such as setting the dom, ordering etc available.

Thank you

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Thanks - I'm really excited to see this new field type being fully exploited - I suspect it has a lot of use cases beyond what I've shown in the examples.

    1) Is it possible to include a datatable field type in an editor form that is not linked to a field that is part of a join.

    Sure - its data feed (the options) can be loaded from anywhere. As long as it comes back in a known JSON format (default is label/value pairs) then the table can be configured to show it. You could use the config.select.style option to disable user selection on the rows:

    type: 'datatable',
    config: {
      select: {
        style: 'api'
      }
    }
    

    the config option just lets you pass in a regular DataTables configuration option. Defaults will be set that are sensible for Editor, but you can override them if you want.

    2) Under the config: section i see how to set paging for scrolling display, are all of the other options available such as setting the dom, ordering etc available.

    Yup :).

    You can even access the api if you wanted to:

    var table = editor.field('myField').dt();
    

    I actually missed adding that method in the docs - corrected for the next patch release already.

    Allan

This discussion has been closed.