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

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

rdmrdm Posts: 194Questions: 55Answers: 4

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: 15,240Questions: 1Answers: 2,599

    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: 63,498Questions: 1Answers: 10,471 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

This discussion has been closed.