Closed e-tip closed 8 years ago
@e-tip Currently there is no thing like that. And I'm not sure we'd need to add it at the moment. It's very specific and basically you can even do that. Let me show you how.
But I'd suggest to do your data manipulation in your controller's code. You don't have to modify anything in your backend. Let me give you an example. In your paginator function is should be something like this:
function paginatorCallback(page, pageSize){
return $http.post('https://api.nutritionix.com/v1_1/search', {
'page': page,
'pageSize': pageSize
}).then(function(result){
//here using the chainable functionality of the promises you can alter yother response
_.each(result.data, function(item, index){
result.data[index].speedInBytes = $filter('bytes')(item.speed);
//or merge two values into one
result.data[index].mergedValue = item.oneValue + '' + item.anotherValue
})
return {
results: result.data,
totalResultCount: result.total
}
});
Is that a possible/acceptable solution for you?
Ohhh, that's so easy that i didn't even thought about it... :+1:
I'm glad I could help. :) This ticket is closed then.
Cheers
Hi, Is there a way to apply filters to ajax loaded table content ? something like 'column-keys': [ 'speed | bytes', ], and the possibility to concatenate two fields of the reply into one columns like {{ loaded_bytes }} of {{ total_bytes }}
Obviously i can modify my backend code to implement this but i think that implement it in mdDataTable would be better Thanks in advance