Usefulness of `function(e)` when activating inline edit on table cell

Usefulness of `function(e)` when activating inline edit on table cell

rdmrdm Posts: 138Questions: 34Answers: 3

I've been using this snippet since day one to enable inline table editing. Clearly it works, but ReSharper keeps suggesting I remove the "unused" parameter e. I'm just curious if there any undocumented uses of that parameter that could be useful for enhancing the below function.

            // Activate an inline edit on click of a table cell
            $('#example').on( 'click', 'tbody td:not(:first-child)', function (e) {
                editor.inline(this);
            });

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 1,193Questions: 0Answers: 226

    Hi @rdm ,

    It can sometimes, it can contain data specific for that event, see the example here where the click event behaviour is modified. It can be used when editing cells, see this example here, but yep, I think ReSharper is correct in your case,

    Cheers,

    Colin

  • allanallan Posts: 46,556Questions: 1Answers: 6,497 Site admin
    Answer ✓

    Just to extent upon that, ReSharper is correct - you aren't using e anywhere in your function and Editor doesn't depend on you passing the event in (thus it can't access it), so you don't need it. It can be safely dropped.

    Allan

Sign In or Register to comment.