Search doesn't work after xeditable update
Search doesn't work after xeditable update
forsakendoll
Posts: 11Questions: 0Answers: 0
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 )
Here is the link of the project (demo http://btool.jrp-mantaring.cloudbees.net/index.do )
This discussion has been closed.
Replies
Yes, you need to use the DataTables API. See: http://datatables.net/faqs#append - the same principle applies.
Allan
[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?