inline edit - modify typed data

inline edit - modify typed data

Andreas S.Andreas S. Posts: 208Questions: 74Answers: 4

Hi,

I have a table in which data is entered in a cell using inline edit. However, I have to put the entered data into a certain format before the data is sent to the server. How can I modify the input before it is sent to the server?

Andreas

Here my code:

        inLine = new $.fn.dataTable.Editor({
            ajax: {
                url: "{{ route('be.single.competition.store') }}",
                headers: {
                    'X-CSRF-Token': '{{ csrf_token() }}'
                }
            },
            table: '#dtCompetition',
            fields: [
                {
                    label: 'entryTime',
                    name: 'entryTime',
                    type: 'mask',
                    mask: '00:00.00',
                    placeholder: '__:__.__'
                }, {
                    label: 'entry',
                    name: 'entry',
                    type: 'checkbox',
                    seperator: '|',
                    options: [
                        {label: 'no', value: 0},
                        {label: 'yes', value: 1}
                    ]
                }, {
                    label: 'eventUuid',
                    name: 'eventUuid',
                }, {
                    label: 'entryUuid',
                    name: 'entryUuid',
                }, {
                    label: 'ageGroup',
                    name: 'ageGroupUuid',
                    data: 'ageGroups.0.ageGroup'
                }
            ],
            formOptions: {
                inline: {
                    submit: 'all',
                    onBlur: 'submit',
                    onEsc: 'submit'
                }
            }
        });

       const table = $('#dtCompetition').DataTable({.....});

table.on('click', 'tbody td.editTime', function () {
   
            inLine
             //   .set('entryTime', setSwimTime($(this).get(0).innerHTML))
                .inline(table.cell(this).index(), {});
        });

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    edited July 9 Answer ✓

    I would suggest using preSubmit. With that you can modify the data format for the object that is sent to the server.

    If it is just the field's value that you are interested in, then fields.getFormatter might work for you as well.

    Allan

Sign In or Register to comment.