Alex
Alex

Reputation: 331

Can you set certain cells to read only in an editable column for DataTables Editable?

I am working with jQuery plugin DataTables and its Editable plugin. I can set columns to be read-only via the parameter aoColumns:

 "aoColumns": 
               [
                    null,   
                    {}, 
                    {
                        indicator: 'Saving...',
                        type: 'select',
                        submit: 'Update',
                        loadURL: 'Home/Test',
                    }
                ]

I can also set each individual cell to read-only by adding read_only class:

<td class="read_only">...</td>

The above works fine as long as I do not specify aoColumns (i.e., all cells are editable by default). Is it possible to make certain cells read-only within an editable column? Notice the reasons I use aoColumns are to use the dropdown box and loadurl.

Upvotes: 0

Views: 1798

Answers (1)

Barbara Laird
Barbara Laird

Reputation: 12717

I use the row callback for a similar problem. Something like this:

 "fnRowCallback": function( nRow, aData, iDisplayIndex ) {
            /* Append the read_only class to Completed rows */
            if ( aData["status"] == "Completed" )
            {
                nRow.className = "read_only";
            }
        },

http://datatables.net/usage/callbacks

Upvotes: 1

Related Questions