Row level editability

Row level editability

mak1mak1 Posts: 25Questions: 13Answers: 1

Hi Allan,

I know I can make certain columns editable and not using a server side role

    var editor = new $.fn.dataTable.Editor( {
        ajax: ...,
        table: ...
    } );

    if ( userAccess === ... ) {
        editor.add( {
            label: 'Name',
            name: 'username'
        } );
    }

    if ( userAccess === ... ) {
        editor.add( ... );
    }

Question, in our use case, once a row/record has been submitted to a manager, none of its field should be editable. Meaning I need to be able to turn on edit access on a row by row basis based on a column status....is that possible?

Answers

  • allanallan Posts: 63,812Questions: 1Answers: 10,516 Site admin

    The built in controls doesn't really allow for that, instead you will need to call the edit() method yourself (rather than using whatever method you are currently using to do it - the Buttons?). You would surround the edit() call with whatever logic you need to decide whether the form should be displayed or not.

    The alternative is to use preOpen - i.e. allow the edit() method to be called as before, but then cancel the form from being displayed, again based on whatever logic you need.

    Allan

  • mak1mak1 Posts: 25Questions: 13Answers: 1

    I am using the Edit button and Inline edit. Any suggestions for inline edit?

  • allanallan Posts: 63,812Questions: 1Answers: 10,516 Site admin

    Basically the same as my first suggestion - use some if condition based on whatever logic you need to decide if you want to call the inline() method or not. row().data() will probably be useful to get the row's data.

    Allan

This discussion has been closed.