Update TableData with inside

Update TableData with inside

hawkmasterhawkmaster Posts: 56Questions: 20Answers: 0
edited April 2014 in General
Hello

I did a TableData editing and saving like described in:

http://datatables.net/blog/Inline_editing

In edit mode I have changed column 3 from input type=text to box.
I want to save the value in a Db which is a integer value, but want to update the table after save with the "option" (text) of the select box.

The fnUpdate works fine with the value
oTable.fnUpdate( jqSelects[0].value, nRow, 2, false );//NEW WITH SELECT BOX Value

But if I try to change to text
oTable.fnUpdate( jqSelects[0].text, nRow, 2, false );

it does not work.

How can I update the table after saving with the text and not with the value?

thanks a lot

hawk

[code]
function saveRow ( oTable, nRow )
{
//alert('jetzt save mit row' + nRow);

var jqInputs = $('input', nRow);
var jqSelects = $('select', nRow);

oTable.fnUpdate( jqInputs[0].value, nRow, 0, false );
oTable.fnUpdate( jqInputs[1].value, nRow, 1, false );
//oTable.fnUpdate( jqInputs[2].value, nRow, 2, false );//OLD WITH INPUT
//oTable.fnUpdate( jqSelects[0].value, nRow, 2, false );//NEW WITH SELECT BOX Value
oTable.fnUpdate( jqSelects[0].text, nRow, 2, false );//TRY with TExt

oTable.fnUpdate( jqInputs[2].value, nRow, 3, false );
oTable.fnUpdate( 'Edit', nRow, 4, false );
oTable.fnDraw();


var timeaccid = jqInputs[0].value;
var projectday = jqInputs[1].value;
//var projectlabel = jqInputs[2].value;
var projectid = jqSelects[0].value;

var projecthours = jqInputs[2].value;

//alert('projectid ist ' + projectid);

//alert('timeaccid: ' + timeaccid + 'day: ' + projectday + ' stunden: ' + projecthours );

$.get(
'UpdateProjectData.php',
[/code]

Replies

  • hawkmasterhawkmaster Posts: 56Questions: 20Answers: 0
    Hello
    I now tried it with "normal" jQuery syntax:

    The select box is in column 3 with the id "sel_devtimeedit"

    var timeselectedit = $('#sel_devtimeedit option:selected').text();
    alert(devtimeselectedit);

    But the Alert is always empty. Why this
    If I do this with a select outside the datatable it works fine

    any idea?

    kind regards
    hawk
  • hawkmasterhawkmaster Posts: 56Questions: 20Answers: 0
    Why is it not possible inside the function saveRow to use the normal jQuery syntax
    $('#sel_devtimeedit option:selected').text();
    to get the text form an element?

    best regards
    hawk
This discussion has been closed.