Editor - Inline Editing conflicts with Checkbox Submit

Editor - Inline Editing conflicts with Checkbox Submit

dpanscikdpanscik Posts: 116Questions: 31Answers: 0

I think this is going to have a simple solution.

I am using both inline editing and checkboxes.

Inline editing uses this statement (which works fine by itself).

        $('#ApForm').on('click', 'tbody td', function (e) {
            editor

                .inline(this, {
                    //onBlur: 'submit'

                });

        });

Checkbox uses this statement (which works fine by itself).

        $('#ApForm').on('change', 'input.editor-active', function () {
            editor
                .edit($(this).closest('tr'), false)
                .set('pinkHighlight', $(this).prop('checked') ? 1 : 0)
                .submit();

        });

However, both combined together and neither works.

        $('#ApForm').on('change', 'input.editor-active', function () {
            editor
                .edit($(this).closest('tr'), false)
                .set('pinkHighlight', $(this).prop('checked') ? 1 : 0)
                .submit();

        });
        $('#ApForm').on('click', 'tbody td', function (e) {
            editor

                .inline(this, {
                    //onBlur: 'submit'

                });

        });

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 61,066Questions: 1Answers: 9,956 Site admin
    Answer ✓

    Change the selector (tbody td) for the inline editing to not include the checkbox columns.

    Allan

  • kthorngrenkthorngren Posts: 19,939Questions: 26Answers: 4,700
    Answer ✓

    You will want to not include the checkbox column in your selector for inline editing. Something like this:

    $('#ApForm').on('click', 'tbody td:not(.editor-active)', function (e) {
    

    Kevin

  • dpanscikdpanscik Posts: 116Questions: 31Answers: 0

    Presto Shazam! Like magic, it works.

    This was discussed in part with a earlier question I had a week or two ago. I just didn't make the connection that the same concept applies with this particular idea.

    My last two columns will have check boxes. Here is my solution.

            $('#ApForm').on('click', 'tbody td:not(:nth-last-child(-n+2))', function (e) {
                editor
    
                    .inline(this, {
                        //onBlur: 'submit'
    
                    });
    
            });
    
Sign In or Register to comment.