Styling only applied to first row?
Styling only applied to first row?
ElliotReevey
Posts: 3Questions: 0Answers: 0
I am adding new rows after passing data back from AJAX via JSON.
The data is adding fine however I want all columns except column 2 to have padding-top: 14px however my code, for some reason, is only applying this to the first row that is added.
[code]
$( data['table_data'] ).each(function( index, domEle) {
var a = oTable.fnAddData( [
domEle['rownum'],
domEle['logo'],
domEle['total_impressions'],
domEle['total_clicks'],
domEle['ecpm'],
domEle['total_media_cost'],
domEle['total_media_cost_diff'],
domEle['total_spend'],
domEle['total_spend_diff']
]);
var nTr = oTable.fnSettings().aoData[ a[0] ].nTr;
$('td:eq(0),td:eq(2),td:eq(3),td:eq(4),td:eq(5),td:eq(6),td:eq(7),td:eq(8)').css('padding-top', '10px');
});
[/code]
Can anyone shed any light on how to make it apply to every row?
Cheers
The data is adding fine however I want all columns except column 2 to have padding-top: 14px however my code, for some reason, is only applying this to the first row that is added.
[code]
$( data['table_data'] ).each(function( index, domEle) {
var a = oTable.fnAddData( [
domEle['rownum'],
domEle['logo'],
domEle['total_impressions'],
domEle['total_clicks'],
domEle['ecpm'],
domEle['total_media_cost'],
domEle['total_media_cost_diff'],
domEle['total_spend'],
domEle['total_spend_diff']
]);
var nTr = oTable.fnSettings().aoData[ a[0] ].nTr;
$('td:eq(0),td:eq(2),td:eq(3),td:eq(4),td:eq(5),td:eq(6),td:eq(7),td:eq(8)').css('padding-top', '10px');
});
[/code]
Can anyone shed any light on how to make it apply to every row?
Cheers
This discussion has been closed.