Error in select2 update row in Datatable

Error in select2 update row in Datatable

klermannklermann Posts: 270Questions: 67Answers: 1
edited October 10 in Free community support

Hello, I am having an error in select2 in the Datatable Editor while trying to update the line in Datatable. Here are images of where I click to update the Datatable Editor line and modal displaying the errors in select2, and also follow the codes of a select2 Datatable Editor for your enjoyment.

It this code:

{
    name: 'tipoDespesas[].id',
    type: "select2",
    opts: {
        language: 'pt-BR',
        tags: true,
        placeholder: "Selecione uma categoria",
        allowClear: true,
        ajax: {
            url: '/financeiro/tipoDespesas/listJson',
            delay: 300,
            processResults: function(obj) {

                var listTR = new Array()

                obj.data.forEach(function(dataTR, i) {
                    listTR[i] = {
                        "text": dataTR.nomeTipoDespesas,
                        "id": dataTR.id
                    };
                });
                return {
                    results: listTR
                };
            },
            data: function(params) {

                var queryParameters = {
                    param: params.term
                }
                return queryParameters;
            },
        },
        createTag: createTag,
        insertTag: insertTag,
        templateResult: templateResult,
        templateSelection: templateSelectionCategorias,
    }
},

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • klermannklermann Posts: 270Questions: 67Answers: 1

    help me!

  • allanallan Posts: 50,505Questions: 1Answers: 7,508 Site admin

    Hi,

    Can you link to a page showing the error so I can help to debug it please?

    Thanks,
    Allan

  • klermannklermann Posts: 270Questions: 67Answers: 1

    Hi, follow - >
    nome(user): datatable@datatable.com
    senha(pass): datatable

    191.209.32.171:888/financeiro/despesas/

  • allanallan Posts: 50,505Questions: 1Answers: 7,508 Site admin

    Thanks for the link. However, I'm afraid its timing out for me at the moment.

    Allan

  • klermannklermann Posts: 270Questions: 67Answers: 1
  • allanallan Posts: 50,505Questions: 1Answers: 7,508 Site admin

    It looks like:

                data: function(params) {
     
                    var queryParameters = {
                        param: params.term
                    }
                    return queryParameters;
                },
    

    Is interfering with the data object that Editor is sending to the server. The Select2 plug-in should be sending an initialValue boolean and value properties when the form is placed into edit mode. The server is then expected to return with the required JSON for that selected value.

    Could you try removing that data function please?

    Allan

  • klermannklermann Posts: 270Questions: 67Answers: 1

    @Allan - I removed the part of the code you asked me for, but the problem persists, as you can check it yourself!

Sign In or Register to comment.