aoFeatures update data
aoFeatures update data
yoni
Posts: 2Questions: 0Answers: 0
Hi,
I am trying to add a new feature to sDom to replace the built in 'info' component.
I am doing that because I want to add buttons to the component.
I can't figure out how can I update the component when the data is updated (e.g on table draw).
My code so far:
[code]
$.fn.dataTableExt.aoFeatures.push({
fnInit: function(oSettings)
{
var d = document.createElement('div');
$(d).append(oSettings.fnFormatNumber(oSettings._iDisplayStart+1));
$(d).append($('', {href: '#', click: function(e)
{
doing something here....
oSettings.oApi._fnReDraw(oSettings);
return false;
}}).text("some text"));
return d;
},
cFeature: "C",
sFeature: "fff"
});
[/code]
Apreciate any help!
Thanks,
Yoni.
I am trying to add a new feature to sDom to replace the built in 'info' component.
I am doing that because I want to add buttons to the component.
I can't figure out how can I update the component when the data is updated (e.g on table draw).
My code so far:
[code]
$.fn.dataTableExt.aoFeatures.push({
fnInit: function(oSettings)
{
var d = document.createElement('div');
$(d).append(oSettings.fnFormatNumber(oSettings._iDisplayStart+1));
$(d).append($('', {href: '#', click: function(e)
{
doing something here....
oSettings.oApi._fnReDraw(oSettings);
return false;
}}).text("some text"));
return d;
},
cFeature: "C",
sFeature: "fff"
});
[/code]
Apreciate any help!
Thanks,
Yoni.
This discussion has been closed.
Replies
I would love to know if this is the right way.
Thanks
Yoni.
[code]
function dt_update_info(d, oSettings)
{
$(d).empty();
$(d).append(oSettings.fnFormatNumber(oSettings._iDisplayStart+1)+'-'+
oSettings.fnFormatNumber(oSettings.fnDisplayEnd())+' of ');
var total = oSettings.fnFormatNumber(oSettings.fnRecordsDisplay());
.... some more logic
}
$(document).ready(function()
{
$.fn.dataTableExt.aoFeatures.push({
fnInit: function(oSettings)
{
var d = document.createElement('div');
oSettings.aoDrawCallback.push({
fn: function(oSettings) {
dt_update_info(d, oSettings);
}, sName: "zinfo"
});
return d;
},
cFeature: "C",
sFeature: "count_link"
});
}
[/code]