non-editable columns

non-editable columns

jakebriemsjakebriems Posts: 2Questions: 2Answers: 0

I have a data table with 20 columns. i'd like to be able to edit only the right-most 6 of them, so I did this:

$('#example').on( 'click', 'tbody td:gt(14)', function (e) {
editor.inline( this );
} );

and that works, but only on the first row. For every other row, all of the cells are editable.

ideas why?

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Hi,

    We discussed this by e-mail, but for anyone else who is looking into this as well, it is possible to achieve what you are looking for by making it a little more specific with the nth-child() operator:

    $('#example').on( 'click', 'tbody td:nth-child(n+14)', function (e) {
        editor.inline( this );
    } );
    

    The jQuery documentation for nth-child() is available here: http://api.jquery.com/nth-child-selector/

    And there is a useful document (and I frequently use as a reference!) about nth-child() here: http://css-tricks.com/useful-nth-child-recipies/

    Regards,
    Allan

This discussion has been closed.