Inline Editing Bug, Editor 1.7.2

Inline Editing Bug, Editor 1.7.2

rf1234rf1234 Posts: 3,004Questions: 87Answers: 421

There seems to be a bug in Editor 1.7.2 with inline editing. When I try to edit inline the editing field opens and then closes again. It is not possible to enter anything. If I open a regular Editor pop up first by clicking the edit button and close it without doing anything I can subsequently enter something with inline editing and everything looks fine. But when I save the inline edited record by hitting enter the "on Open" settings (see code below) aren't done. Field cashflow.manual should be set to 1 but it isn't.

To me this looks like inline editing doesn't get initialized properly and even after opening an Editor popup it isn't being initialized fully because the "on Open" event seems to be ignored OR the fields aren't sent to the server. Couldn't figure that out.

All of this has been working perfectly fine with Editor 1.6.5 so my work around was to go back to Editor 1.6.5.. Happy that everything works again, but it cost me a couple of hours to figure this out.

"Regular" editing clicking the edit button works fine by the way, also in Editor 1.7.2. This is only about inline editing with Editor 1.7.2.

Here is my JS code:

var cashFlowEditor = new $.fn.dataTable.Editor({
    ajax: {
        url: 'actions.php?action=tblCashFlow',
        data: function (d) {
            var selected = contractTable.row({selected: true});
            if (selected.any()) {
                d.contract_id = selected.data().contract.id;
            }
        }
    },
    table: "#tblCashFlow",
    formOptions: {
        inline: {
            submit: 'allIfChanged'
        }
    },
    fields: [{
            type: "hidden",
            name: "cashFlowElement"
        }, {              
            label: "Payment date:",
            name: "cashflow.payment_date",
            attr: {
                class: dateMask
            },
            type: "datetime",
            format: 'L',
            opts: {
                showWeekNumber: true,
                yearRange: 40,
                momentLocale: momentLocale
            }
        }, {
            label: "Interest date:",
            name: "cashflow.interest_date",
            attr: {
                class: dateMask
            },
            type: "datetime",
            format: 'L',
            opts: {
                showWeekNumber: true,
                momentLocale: momentLocale
            } 
        }, {
            label: "Repayment (if any):",
            name: "cashflow.repayment",
            attr: {
                class: amountMask
            }
        }, {
            label: "Rate % (incl. spread):",
            name: "cashflow.rate"
        }, {
            label: "Interest amount:",
            name: "cashflow.interest",
            attr: {
                class: amountMask
            }        
        }, {
            label: "Fee (if any):",
            name: "cashflow.fee",
            attr: {
                class: amountMask
            }       
        }, {
            type: "hidden",
            name: "cashflow.manual"
        }, {
            type: "hidden",
            name: "cashflow.additional_repayment"
        }
    ]
});
cashFlowEditor
        .on('open', function (e, mode, action) {
            var self = this;       
            self.set({'cashflow.manual': 1,
                          'cashflow.additional_repayment': 0 });
})

// Activate an inline edit on click of a table cell
    $('#tblCashFlow').on( 'click', 'tbody tr.inlineRepaymentInterest td.inlineCashFlow',
        function (e) {
            cashFlowEditor.inline( this )
    } );

Replies

  • allanallan Posts: 63,578Questions: 1Answers: 10,483 Site admin

    Hi,

    Are you able to give me a link to a page showing the issue please? The examples here all appear to work okay and I don't see anything in your code that would trigger such a problem, so I'd probably need to debug it directly.

    Thanks,
    Allan

  • rf1234rf1234 Posts: 3,004Questions: 87Answers: 421
    edited February 2018

    ok, how can I send you log in details and a more detailed description on how to get in safely?

  • allanallan Posts: 63,578Questions: 1Answers: 10,483 Site admin

    If you click my name above and then hit the "Send message" button, that will send me a private message.

    Allan

  • rf1234rf1234 Posts: 3,004Questions: 87Answers: 421
    edited February 2018

    Just to summarize my discussion with Allan which is relevant for people using inline editing with Editor 1.7.2 (I went back to Editor 1.6.5 to avoid the issues described below).

    Using inline editing will only populate the inline editable fields reading from the server. So if you are doing something programmatically with the incoming editor fields e.g. in an "on open" event handler you have a problem if these fields aren't inline editable simply because they won't be populated.

    Inline editing will also only send the inline edited fields to the server OR the inline editable fields depending on whether or not you use the "allIfChanged" option. That will cause a problem if you set additional editor fields programmatically because they won't be sent to the server.

    The above summarizes my experience; can't guarantee whether this is 100% accurate though ...

This discussion has been closed.