Editable Plugin

Editable Plugin

nobody.gavinnobody.gavin Posts: 5Questions: 0Answers: 0
edited March 2010 in General
[code]
"fnDrawCallback": function() {
$('#example tbody td:nth-child(3)').editable( function(value, settings) {
return(value);
}, {
callback: function( sValue, y ) {
var aPos = oTable.fnGetPosition( this );
oTable.fnUpdate( sValue, aPos[0], aPos[1] );
},
submitdata: function ( value, settings ) {
return { "row_id": this.parentNode.getAttribute('id') };
},
tooltip : "Doubleclick to edit",
onblur : "submit",
event : "click",
height: "14px",
data : " {'Win':'Windows','Linux':'Linux System','Unix':'Unix System'}",
type:"select"
} );
[/code]


I would like to use JSON instead of " {'Win':'Windows','Linux':'Linux System','Unix':'Unix System'}"

Any Clue on how to do that? thanks.

Replies

  • nobody.gavinnobody.gavin Posts: 5Questions: 0Answers: 0
    edited April 2010
    [code]
    var returnArray;
    $.ajax({
    "dataType": 'json',
    "type": "POST",
    "url": "SelectDataServlet",
    "success": function(data) {
    returnArray= data;
    }
    });


    "fnDrawCallback": function() {
    $('#example tbody td:nth-child(3)').editable( function(value, settings) {
    return(value);
    }, {
    callback: function( sValue, y ) {
    var aPos = oTable.fnGetPosition( this );
    oTable.fnUpdate( sValue, aPos[0], aPos[1] );
    },
    submitdata: function ( value, settings ) {
    return { "row_id": this.parentNode.getAttribute('id') };
    },
    tooltip : "Doubleclick to edit",
    onblur : "submit",
    event : "click",
    height: "14px",
    data : returnArray,
    type:"select"
    } );
    [/code]
    Looks like it works.
  • nobody.gavinnobody.gavin Posts: 5Questions: 0Answers: 0
    If the value of data is dynamic not fixed, how could I do?
This discussion has been closed.