Editable column

Editable column

kekitokekito Posts: 15Questions: 0Answers: 0
edited August 2010 in General
Sorry,

i have some problems because i can't use that kind of table. I'm trying to connect with the table to database which should be updated after change that column. I thoght i could do that with jeditable.

i cant use that table, what should i do? the example is a little bit short, i don't understand the use.

thxs.

Replies

  • kekitokekito Posts: 15Questions: 0Answers: 0
    $(document).ready(function() {

    oTable = $('#example').dataTable({
    "oLanguage": {
    "sUrl": "language/spanish_table.txt"
    },
    "sPaginationType": "full_numbers",
    "bJQueryUI": true,
    "bProcessing": true,
    "bServerSide": true,
    "aaSorting": [[0, 'asc']],
    "sAjaxSource": "php/products.php"
    });

    $('#example td').editable( 'php/server.php', {
    alert("SI");
    } );



    } );














    R
    Modelo
    Colecci
  • kekitokekito Posts: 15Questions: 0Answers: 0
    hi,

    i have this code now,
    [code]
    var oTable;
    $(document).ready(function() {
    oTable = $('#example').dataTable( {
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "php/administradors.php",
    "fnDrawCallback": function () {
    $('#example tbody td').editable( 'php/server.php', {
    "callback": function( sValue, y ) {
    var aPos = oTable.fnGetPosition( this );
    var aData = oTable.fnGetData( aPos[0] );
    alert(y);

    //oTable.fnUpdate(sValue, aPos[0], aPos[1]);
    //oTable.fnDraw();
    },
    "error": function (XMLHttpRequest, textStatus, errorThrown) {
    alert( "XMLHttpRequest: "+XMLHttpRequest+" errorThrown: "+errorThrown+" textStatus: "+textStatus );
    },
    "cssclass" : 'expanding',
    "height": "14px",
    "event" : "click",
    "tooltip" : 'Haz click para editarlo...',
    "indicator" : 'saving',
    });
    }
    } );
    } );
    [/code]

    it works, now i have some problemes.. the PHP server.php is processing de callback call.I need pass to that PHP more than new value, some identifier to update database. How can i do that??
    please need help.

    I would like to pass another param to php, to do a switch in php, to know which attribute update in database.

    thxs
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You can send extra information to the server through the use of fnServerData: http://datatables.net/examples/server_side/custom_vars.html

    Allan
  • kekitokekito Posts: 15Questions: 0Answers: 0
    hi allan,
    i solved like this

    [code]
    $(document).ready(function() {
    TableToolsInit.sSwfPath = "media/swf/ZeroClipboard.swf";
    table = $("#example").dataTable( {
    "sDom": 'T<"clear">lfrtip',
    "oLanguage": {
    "sUrl": "language/spanish_table.txt"
    },
    "bJQueryUI": true,
    "sPaginationType": "full_numbers",
    "bProcessing": true,
    "bServerSide": true,
    "aaSorting": [[0, 'asc']],
    "sAjaxSource": "php/administradors.php",
    "fnDrawCallback": function () {
    $("#example tbody td").editable( "php/server.php", {
    "callback": function( sValue, y ) {
    //$(this).highlightFade({ start: 'red', iterator: 'sinusoidal', speed: 3000 });
    var aPos = table.fnGetPosition( this );
    var aData = table.fnGetData( aPos[0] );
    sleep(1000);
    table.fnDraw();
    },
    submitdata : function(value, settings) {
    var aPos = table.fnGetPosition( this );
    var aData = table.fnGetData( aPos[0] );
    return {
    id: aData[0],
    pos: aPos[1],
    };
    },
    "cssclass" : "centerclass",
    "cancel" : "No",
    "indicator" : "",
    "submit" : "Ok",
    "height" : "14px",
    "event" : "click",
    "tooltip" : "Haz click para editarlo...",
    });
    }
    } );
    } );

    [/code]
  • kekitokekito Posts: 15Questions: 0Answers: 0
    Now, i have another problem...

    i'm trying to fix one of the columns, because it can't be modified by user.. how can i do that?

    thxs for ur fast answer
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You need to modify the selector. At the moment you have all cells being used: $("#example tbody td").editable(...). You need to modify the 'tbody td' bit to not include the cells you don't want to be editable: http://api.jquery.com/category/selectors/

    Allan
  • kekitokekito Posts: 15Questions: 0Answers: 0
    ok, but how can i select just one of this??

    for example.. i don't want that column ID, the first column. how can i do that??

    i tryed with .not("td:eq(0)") but doesnt work, because it just take de first row... why?
This discussion has been closed.