Changing aoData in fnServerData()
Changing aoData in fnServerData()
DavidB
Posts: 4Questions: 0Answers: 0
Hi all,
I'm working with multiple datatables and have written a number of external controls. To achieve this I am populating aoData with extra information and in certain cases changing the default data such as iDisplayLength within the fnServerData() function.
Is there an easier way to achieve this than doing a manual loop of the array and changing the values in each object as I need?
[code]
$.each(aoData, function(key, val){
if (val.name == 'iDisplayLength')
{
aoData[key].value = dt_options.iDisplayLength;
}
});
[/code]
I've scoured the API for setter methods but couldn't find any, I'm sure I'm missing a trick here so any feedback would be great.
Thanks,
Dave
I'm working with multiple datatables and have written a number of external controls. To achieve this I am populating aoData with extra information and in certain cases changing the default data such as iDisplayLength within the fnServerData() function.
Is there an easier way to achieve this than doing a manual loop of the array and changing the values in each object as I need?
[code]
$.each(aoData, function(key, val){
if (val.name == 'iDisplayLength')
{
aoData[key].value = dt_options.iDisplayLength;
}
});
[/code]
I've scoured the API for setter methods but couldn't find any, I'm sure I'm missing a trick here so any feedback would be great.
Thanks,
Dave
This discussion has been closed.
Replies
So yes a loop is needed. I'd suggest you use a single function and have something like `pluck( aoData, 'iDisplayLength') rather than an 'each' for every property, but that's the basic idea...
Allan
Thanks,
Dave