Inline editing not saving with new ajax source

Inline editing not saving with new ajax source

test42test42 Posts: 21Questions: 8Answers: 0
edited September 2018 in Editor

Hi,

I'm switching between data using a dropdown that loads in a new ajax source. I notice when I go to edit the newly loaded data inline it does not update the database. I'm assuming the table is getting the new data but the editor is not in sync. Is there something additional I need to do? (I've tried reload to no avail)

//Getting selected value from dropdown
        var deptSelected;
        $('#reportSelect').on('change', function() {
            deptSelected = this.value;
            $('#reportSelect').find('option:contains("' + deptSelected + '")').attr("selected", true);
            loadData(deptSelected);
        });

        //loading selected value and redrawing table
        function loadData(d) {
            var myURL = "./php/table." + d + ".php";
            table.ajax.url(myURL).load();
            //table.ajax.reload();
        }

Thanks!

Answers

  • test42test42 Posts: 21Questions: 8Answers: 0
    edited September 2018

    So I searched high and low and found no answers to this question. I couldn't find in the API of the editor to update the Ajax so I manually dug into the object and found I could override it. It surprisingly works well and updates the database values. My question now is there an API option I missed and if I stick with this code will it work long term? (relying on 's').

    function loadData(d) {
                var myURL = "./php/table." + d + ".php";
                table.ajax.url(myURL).load();
                editor.s.ajax = myURL;
    
            }
    

    Thanks!!

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

    Hi,

    I couldn't find in the API of the editor to update the Ajax

    You wouldn't, there isn't one. Editor's Ajax options are a lot more complex that DataTables since it allows an object of CRUD parameters to allow Ajax options for each one. That said, perhaps there should be one and there just be a note in the documentation reflecting that to the developer.

    I've made a note of that for 1.8 which I'm working on at the moment.

    Allan

This discussion has been closed.