how can i get this input_text value

how can i get this input_text value

skymoodskymood Posts: 8Questions: 0Answers: 0
edited September 2009 in General
[code]

1




1



[/code]


in this Render function of example

"fnRender": function ( oObj ) {return oObj.aData[0] +' '+ oObj.aData[3];

aData[] return innerHtml of ""

when I use DataTables with column rendering,how can i get the value of the input

how CAN I do?

please help me

thank you:)

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi skymood,

    DataTables is passing you the string of the cell, not the live DOM reference. So I suspect that what you want to do is something a bit like this:

    [code]
    fnRender: function ( o ) {
    var nTr = oTable.fnSettings().aoData[ o.iDataRow ].nTr;
    var val = $('input', nTr).val();
    // Do whatever you want with the val
    }
    [/code]
    It's perhaps a little bit cumbersome to get the node this way (I'll look at this for a future enhancement), but it should do the trick for you.

    Regards,
    Allan
  • skymoodskymood Posts: 8Questions: 0Answers: 0
    edited September 2009
    =======================
    $(':text').keyup(function(){
    /* Get the position of the current data from the node */
    var aPos = oTable.fnGetPosition(this.parentNode);
    /* Get the data array for this row */
    var aData = oTable.fnGetData( aPos[0] );
    =======================
    ok.
    I use KEYUP events and fnUpdate method to complete the corresponding column update

    My original idea was to obtain the value of the input box and then use Column Render function/redarw

    I have completed my thoughts

    Thank convenience of DataTales I have some grammatical errors in English

    I hope you can understand


    thank you
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi skymood,

    Just had one thought about the code that I posted - the oTable object probably doesn't exist when fnRender runs for the first time! I've just added the code required to pass oSettings to fnRender to my development version of DataTables, and this will be released with 1.5.3 (hopefully not to far in the future!).

    Beyond that, is everything working for you now?

    Regards,
    Allan
This discussion has been closed.