Disable editing of one cell based on its content

Disable editing of one cell based on its content

eclipsetalkeclipsetalk Posts: 10Questions: 3Answers: 0
edited September 2018 in Free community support

Hello,
I'm enable column 6 for editing as follow:

         "fnDrawCallback" : function() {
                        tableGrid.$('td:eq(6)').editable(function(value, settings) {
                             var td = $('td#' + this.id);
                             displayStuff(td, this.id, value);
                         }, {
                            type        : 'text',
                            cssclass    : 'textInline',
                             name        : 'textInline',
                             submit      : 'Ok',
                             cancel      : 'Cancel'
                         });
                    },

I'd like to disable the editing for the cells for which the html content is a given value. How can I do that?

Thanks in advance for any pointers.

Answers

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin

    You'd need to either modify the selector you are using to check if there is content for whatever value, or refer to whatever plug-in it is that you are using for the editable() action (xEditable?) and see if it has an even that you can cancel.

    Allan

  • eclipsetalkeclipsetalk Posts: 10Questions: 3Answers: 0

    Thanks for the reply.
    I'm using dataTable and jquery.jeditable.mini.js for the editable().

     var tableGrid = $('#grid').dataTable({
                "dom": "frtip",
                "bStateSave": true,
                "paging": false,
    

    I tried to get the click event as follow. However I get the event on all the cells except the one that is editable.

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

    Could you please expand on how to go about modifying the selector?
    Thanks

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin

    That might mean that jEditable is doing some kind of stopPropagation itself. I haven't used jEditable in years I'm afraid so I don't know the ins and outs of it. You'd probably need to ask the developer of that software, with a link to a page showing the issue.

    It would also be worth trying it without DataTables so see if that is what is causing the issue.

    Allan

  • eclipsetalkeclipsetalk Posts: 10Questions: 3Answers: 0

    Thanks I'll keep digging around.

This discussion has been closed.