Editable rows: exclude columns

Editable rows: exclude columns

flipper01flipper01 Posts: 4Questions: 0Answers: 0
edited August 2010 in General
I made my rows editable, but I want to exclude some columns so they can't be edited. My code is now like this:
[code]
$(document).ready(function() {
$('#relatiebeheer').dataTable( {
/* Mogelijkheid om horizontaal te scrollen */
"sScrollX": "100%",
"sScrollXInner": "200%",
"bScrollCollapse": true,
/* Vertalen van sommige objecten */
"oLanguage": {
"sLengthMenu": "Geef _MENU_ relaties per pagina weer",
"sInfo": "Weergave: _START_ van _END_ van in totaal _TOTAL_ relaties",
"sInfoFiltered": "(gefilterd uit _MAX_ relaties)"
}
});
/* Init DataTables */
var oTable = $('#relatiebeheer').dataTable();
/* Apply the jEditable handlers to the table */
$('td', oTable.fnGetNodes()).editable( 'DataTables-1.7.1/examples/examples_support/editable_ajax.php', {
"callback": function( sValue, y ) {
var aPos = oTable.fnGetPosition( this );
oTable.fnUpdate( sValue, aPos[0], aPos[1] );
},
"submitdata": function ( value, settings ) {
return {
"col_id": this.getAttribute('category'),
"row_id": this.parentNode.getAttribute('id')
};
},
"height": "14px"
} );
} );[/code]

The table looks like this:
[code]


Organisatie
Naam
Adres
Postcode




<? echo $data->organisatie;?>
<? echo $data->voorletter . " " . $data->tussenvoegsel . " " . $data->achternaam;?>
<? echo $data->adres;?>
<? echo $data->postcode;?>










[/code]

Replies

  • moflemofle Posts: 11Questions: 0Answers: 0
    var rows = oTable.fnGetNodes();

    $(rows).not('.class-of-rows-to-exclude').editable();
  • flipper01flipper01 Posts: 4Questions: 0Answers: 0
    Where should I put this part of the code?? I don't seem to get it to work..
  • moflemofle Posts: 11Questions: 0Answers: 0
    Sorry, read the question wrong.

    // caches the rows
    var rows = oTable.fnGetNodes();

    // makes the rows nodelist an jQuery object, finds all the td (columns), filters out the td with the class you set.
    $(rows).find('td').not('.class-of-rows-to-exclude').editable();





    With your code:

    [code]
    $(document).ready(function() {
    $('#relatiebeheer').dataTable( {
    /* Mogelijkheid om horizontaal te scrollen */
    "sScrollX": "100%",
    "sScrollXInner": "200%",
    "bScrollCollapse": true,
    /* Vertalen van sommige objecten */
    "oLanguage": {
    "sLengthMenu": "Geef _MENU_ relaties per pagina weer",
    "sInfo": "Weergave: _START_ van _END_ van in totaal _TOTAL_ relaties",
    "sInfoFiltered": "(gefilterd uit _MAX_ relaties)"
    }
    });
    /* Init DataTables */
    var oTable = $('#relatiebeheer').dataTable();
    /* Apply the jEditable handlers to the table */
    // caches the rows
    var rows = oTable.fnGetNodes();
    // makes the rows nodelist an jQuery object, finds all the td (columns), filters out the td with the class you set.
    $(rows).find('td').not('.exclude').editable( 'DataTables-1.7.1/examples/examples_support/editable_ajax.php', {
    "callback": function( sValue, y ) {
    var aPos = oTable.fnGetPosition( this );
    oTable.fnUpdate( sValue, aPos[0], aPos[1] );
    },
    "submitdata": function ( value, settings ) {
    return {
    "col_id": this.getAttribute('category'),
    "row_id": this.parentNode.getAttribute('id')
    };
    },
    "height": "14px"
    } );
    } );
    [/code]


    [code]



    Organisatie
    Naam
    Adres
    Postcode




    <? echo $data->organisatie;?>
    <? echo $data->voorletter . " " . $data->tussenvoegsel . " " . $data->achternaam;?>
    <? echo $data->adres;?>
    <? echo $data->postcode;?>











    [/code]
  • flipper01flipper01 Posts: 4Questions: 0Answers: 0
    Great, thnx!!
This discussion has been closed.