Search doesn't work after xeditable update

Search doesn't work after xeditable update

forsakendollforsakendoll Posts: 11Questions: 0Answers: 0
edited April 2014 in Bug reports
I'm using Twitter Bootstrap X-Editable (demo http://vitalets.github.com/x-editable/demo.html) plugin with DataTables. But when ever I updated the value of one the cells through X-Editable the filter seems doesn't recognize the change. Is there a way for the DataTables to recognize the change in data?

Here is the link of the project (demo http://btool.jrp-mantaring.cloudbees.net/index.do )

Replies

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin
    > Is there a way for the DataTables to recognize the change in data?

    Yes, you need to use the DataTables API. See: http://datatables.net/faqs#append - the same principle applies.

    Allan
  • forsakendollforsakendoll Posts: 11Questions: 0Answers: 0
    @allan Here is how I update the other column if I change the value of a specific column

    [code]
    /* Labor Factor */
    $('.laborCostIndex').editable({
    pk: '1',
    name: 'laborCostIndex',
    url: '../BTool/edit_laborCostIndex.do',
    validate: function( value ) {
    if($.trim( value ) == '') {
    return 'This field is required';
    } else if( isNaN( value ) ) {
    return 'Only accepts numbers';
    }
    },
    params: function(params) {
    var basicDailyWage = $(this).closest('td').next('td').find('a').text();
    var pagIbig = $(this).closest('tr').find(':nth-child(11)').find('a').text();
    var emp = $(this).closest('tr').find(':nth-child(13)').find('a').text();
    var datas = new Array(basicDailyWage, pagIbig, emp);

    params.pk = datas;
    return params;
    },
    success: function(response, newValue) {

    /* parse JSON string to javascript object */
    var data = JSON.parse(response);
    /* nearest TR element */
    var $trElement = $(this).closest('tr');

    /* Set values to the other field that should be automated */
    $trElement.find(':nth-child(6)').html( data.laborHourlyWage );
    $trElement.find(':nth-child(7)').html( data.laborMonthlyWage );
    $trElement.find(':nth-child(8)').html( data.laborLeave );
    $trElement.find(':nth-child(9)').html( data.laborBonus );
    $trElement.find(':nth-child(10)').html( data.laborSSS );
    $trElement.find(':nth-child(12)').html( data.laborPhilHealth );
    $trElement.find(':nth-child(14)').html( data.laborTotalMonthlyRate );
    $trElement.find(':nth-child(15)').html( data.laborTotalDailyRate );
    $trElement.find(':nth-child(16)').html( data.laborTotalHourlyRate );
    }
    });
    [/code]

    What do you suggest for me to reflect the changes to the DataTables?
  • forsakendollforsakendoll Posts: 11Questions: 0Answers: 0
    @Allan. Thank you for the clue. Instead of changing the values using jQuery tags. I used fnUpdate to update the values.
This discussion has been closed.