Disable Bubble Editing

Disable Bubble Editing

dckidddckidd Posts: 2Questions: 1Answers: 0

I am close to having this kind of figured out but cannot get it exactly right. How can I only allow "cells" to be edited if the value in the data is only NULL. I would like to only allow editing where the data is NULL or has a value of UPDATE in the cell.

Any help would be appreciated.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    Hi,

    What you would need to do is check the value of the cell before calling the bubble() method. For example you could use cell().data() to check the data value for the cell in question (in your event handler) and use a simple if condition to see if it is null:

    $('#myTable').on( 'click', 'tbody td', function () {
      if ( table.cell( this ).data() !== null ) {
        editor.bubble( this );
      }
    } );
    

    or something to that effect!

    Allan

  • dckidddckidd Posts: 2Questions: 1Answers: 0
    edited January 2015

    thanks. that helped immensely. In the end, I got this to work:

    $('#example').on( 'click', 'tbody td', function (e) {
            var index = $(this).index();
            var table = $('#example').DataTable();                       
            
            if ( index === 1 && table.cell( this ).data() == "OPEN" ) {
                editor.bubble( this, {
                    buttons: true,
                    title: 'Add First Name and Last Name:'
                } );
            }
    
This discussion has been closed.