make read only column

make read only column

rajsirrajsir Posts: 10Questions: 0Answers: 0
edited August 2011 in General
Hi All - I am new to the datatables, I am trying to make a read only columns and per the one of the thread i made "sClass: readonly" but, still not working.... any help is greatly appreciated.

"aoColumnDefs": [
{ "sClass": "readonly", "aTargets": [1] }
] --- but the column still editable... I don't know where I am going wrong...

this is my full code:


$(document).ready(function() {
/* Init DataTables */
oTable = $('#myDataTable').dataTable({
"bServerSide": true,
"sAjaxSource": "processor?action=select&table=acctrollups",
"bProcessing": true,
"sPaginationType": "full_numbers",
"bJQueryUI": true
}).makeEditable({
sUpdateURL: "processor?action=update&table=acctrollups",
sUpdateHttpMethod: "POST",
sAddURL: "processor?action=new&table=acctrollups",
sAddHttpMethod: "POST",
sDeleteHttpMethod: "POST",
sDeleteURL: "processor?action=delete&table=acctrollups",
"aoColumns": [ {
},

{
cssclass: "required",
indicator: 'Saving...',
tooltip: 'Click to edit',
onblur: 'submit',

},
{
cssclass: "required",
indicator: 'Saving...',
tooltip: 'Click to edit',
onblur: 'submit',

}],
"aoColumnDefs": [
{ "sClass": "readonly", "aTargets": [0] }

],
"aaSorting": [ [0,'desc'], [1,'asc'] ],
sAddNewRowFormId: "formAddNewRow",
oAddNewRowButtonOptions: { label: "+ Add", icons: {primary:'ui-icon-plus'}},
oDeleteRowButtonOptions: { label: "X Remove", icons: {primary:'ui-icon-trash'}},
oAddNewRowFormOptions: {
title: 'Add New Parent Child Account Mappings',
show: "blind",
hide: "explode",
modal: true} ,
sAddDeleteToolbarSelector: ".dataTables_length"});

//oTable.fnSetColumnVis( 0, false );
} );

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    edited August 2011
    the correct way to make a column not editable is to pass 'null' to the makeEditable column def. see line 9 below. see also: http://jquery-datatables-editable.googlecode.com/svn/trunk/custom-editors.html

    [code]
    .makeEditable({
    sUpdateURL: "processor?action=update&table=acctrollups",
    sUpdateHttpMethod: "POST",
    sAddURL: "processor?action=new&table=acctrollups",
    sAddHttpMethod: "POST",
    sDeleteHttpMethod: "POST",
    sDeleteURL: "processor?action=delete&table=acctrollups",
    "aoColumns": [
    null, /// THIS COLUMN IS NOT EDITABLE
    {
    cssclass: "required",
    indicator: 'Saving...',
    tooltip: 'Click to edit',
    onblur: 'submit',

    },
    {
    cssclass: "required",
    indicator: 'Saving...',
    tooltip: 'Click to edit',
    onblur: 'submit',

    }],
    "aaSorting": [ [0,'desc'], [1,'asc'] ],
    sAddNewRowFormId: "formAddNewRow",
    oAddNewRowButtonOptions: { label: "+ Add", icons: {primary:'ui-icon-plus'}},
    oDeleteRowButtonOptions: { label: "X Remove", icons: {primary:'ui-icon-trash'}},
    oAddNewRowFormOptions: {
    title: 'Add New Parent Child Account Mappings',
    show: "blind",
    hide: "explode",
    modal: true} ,
    sAddDeleteToolbarSelector: ".dataTables_length"});

    } );
    [/code]
  • rajsirrajsir Posts: 10Questions: 0Answers: 0
    Yes, i did that... when i double click that column, text box appears... I don't want to text box in that column... instead it I want to display "Column ID is not editable" something like this.. thanks a lot
  • rajsirrajsir Posts: 10Questions: 0Answers: 0
    sorry i got it.... moved to makeeditable()... it works.


    thanks a lot.
This discussion has been closed.