How to prevent inline editing on a column

How to prevent inline editing on a column

ngungongungo Posts: 64Questions: 23Answers: 2

I want to prevent inline editing on a column so I define a class of no_edit on that column thinking I can do something like this:

$('#my_table').on( 'click', 'tbody td:not(:first-child)', function (e) {
  if (the class of this is not no_edit) editor.inline(this); 
});

Problem is how do I do the class of this is not no_edit? Any suggestions would be appreciated.

ngungo

This question has accepted answers - jump to:

Answers

  • Justin_HJustin_H Posts: 3Questions: 2Answers: 1
    Answer ✓

    you're already using jquery so a quick googling led me to this:

    if(!$(e.target).hasClass('no_edit){
    editor.inline(this);
    }

    if that's not bang on, just fiddle with it in a debugger or ask on jquery/js forums maybe

  • ngungongungo Posts: 64Questions: 23Answers: 2

    It's brilliant. :)
    Thanks!

  • allanallan Posts: 61,805Questions: 1Answers: 10,119 Site admin
    Answer ✓

    I think it can be simplified - just use a selector of td:not(.no_edit)? See also this example.

    Allan

  • ngungongungo Posts: 64Questions: 23Answers: 2

    Thank you, Allan!

This discussion has been closed.