Inline Editor Remove focus class on Change or onBlur Click on an other Field

Inline Editor Remove focus class on Change or onBlur Click on an other Field

HaroldPeetHaroldPeet Posts: 8Questions: 2Answers: 0

I am using the Inline editor with keys: to update a couple fileds in a table.

Everything works as expected what I am hoping to find is a way to remove the focus after update or if I click a different field in the table onBlur. After update or clcking a different filed if I hit the esc key it clears the focus class on the previously selected field.

I have tried many different variations but with no luck, the submit works and it also refreshes an iFrame on chnge.

I am pretty new so lot's of trial and error but no joy.

    editor.field('quantity').input().on('change', function(e, data) {
        if (!data || !data.editor) {
        editor.submit();
        editor.field('quantity').classList.remove("focus");
        window.parent.document.getElementById('TransactionTotal').contentDocument.location.reload(true);
        }
     });

Any thoughts or input would be greatly apreciatted.

Harold

Answers

  • HaroldPeetHaroldPeet Posts: 8Questions: 2Answers: 0

    I had enabled KeyTable for navigation. I believe that is what was maintaining focus even if you navigated away from the Field.

    Adding the below line apears to remove focus on change

    table.cell.blur();
    
    editor.field('quantity').input().on('change', function(e, data) {
        if (!data || !data.editor) {
        editor.submit();
    window.parent.document.getElementById('TransactionTotal').contentDocument.location.reload(true);
          table.cell.blur();
            }
         });
    
  • HaroldPeetHaroldPeet Posts: 8Questions: 2Answers: 0

    Noticing the relationship to KeyTable, I removed the keys: function and enabled inline editing and everything works as I had hoped.

        $('#TransactionOpen').on( 'click', 'tbody td:not(:last-child)', function (e) {
            editor.inline(this);
            });
    

    Take Care

    Harold

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    edited March 2023

    Yes - you typically wouldn't want to call inline() yourself as well as having KeyTable do it. They will conflict. Instead just let KeyTable do it.

    Allan

Sign In or Register to comment.