Datatables defaults on datatable fields in Editor

Datatables defaults on datatable fields in Editor

BjornHaBjornHa Posts: 61Questions: 11Answers: 0

Hi,
Does datatable fields in Editor adhere to any of the settings in DataTable.defaults if the code extends those properties?

This question has an accepted answers - jump to answer

Answers

  • rf1234rf1234 Posts: 3,187Questions: 92Answers: 438
    edited November 4

    I don't think so. Editor has its own defaults in
    DataTable.Editor.defaults

    https://editor.datatables.net/manual/options#Setting-defaults

    https://editor.datatables.net/manual/i18n#Defaults

    You might have meant field type 'datatable'.
    If so the DataTable.defaults should be valid for the datatable fields inside field type 'datatable'. I've been using this a lot and I didn't notice any deviations.

    https://editor.datatables.net/reference/field/datatable

  • allanallan Posts: 65,298Questions: 1Answers: 10,827 Site admin
    Answer ✓

    Yes, as @rf1234 indicated, datatable will inherit the defaults from the DataTable.defaults object (all DataTables on the page will).

    datatable will set some values that override the defaults:

                        {
                            buttons: [],
                            columns: [
                                {
                                    data: conf.optionsPair.label,
                                    title: 'Label'
                                }
                            ],
                            deferRender: true,
                            dom: layout ? null : 'fiBtp',
                            language: {
                                paginate: {
                                    next: '>',
                                    previous: '<'
                                },
                                search: '',
                                searchPlaceholder: 'Search'
                            },
                            layout: layout
                                ? {
                                        top: hasButtons
                                            ? ['search', 'buttons', 'info']
                                            : ['search', 'info'],
                                        bottom: ['paging'],
                                        bottomStart: null,
                                        bottomEnd: null,
                                        topStart: null,
                                        topEnd: null
                                  }
                                : null,
                            lengthChange: false,
                            select: {
                                style: conf.multiple ? 'os' : 'single'
                            }
                        }
    

    You can use the config property of the datatable field type configuration object to specify your own options for the DataTable.

    Allan

  • BjornHaBjornHa Posts: 61Questions: 11Answers: 0

    I can see that buttons then are overridden by the datatable field settings (Yes, I meant the Datatable Field Type).
    I think is where I get some missmatch.
    Thanks for the reply,
    Bjørn H

  • BjornHaBjornHa Posts: 61Questions: 11Answers: 0
    edited November 4

    See new question

Sign In or Register to comment.