I am a beginner in javascript. I have researched the forum for answers to my question. there were a couple that I think I could have used except with my code I am, not sure where or how to put it. Can someone help me? I need to show the eight rows right aligned. Thank you !!!
results.each(function(index) {
var result = "";
var theseClmStats = record.tables.PlanClmStats[index].tables.ClmStats;
var thisPlanClmStats = record.tables.PlanClmStats[index];
//query("#test").append(thisPlanClmStats.fields["PlanName"]+ " (" + index + ') has ' + thisPlanClmStats.tables.length +' table(s)<br/>');
if(thisPlanClmStats.fields.PlanId != null) {
theseClaimSource = thisPlanClmStats.tables.ClmStats.ClaimSource;
result += '<tr data-repeat="" data-breakable="ClaimSource' + index +'">';
result += '</tr>';
var ClmStatslen = theseClmStats.length;
for (var i=0; i < ClmStatslen; i++) {
var thisClmStats = theseClmStats[i];
result += '<tr data-repeat="" data-breakable="ClmStats' + i +'">';
result += '<td><br/></td>';
result += '<td class="data PlanID" textAlign:right>'+ thisClmStats.fields["ClaimSource"] + '</td>';
result += '<td class="data PlanID">'+ thisClmStats.fields["UniqueParticipants4"] + '</td>';
result += '<td class="data PlanID">'+ thisClmStats.fields["ClaimVolume4"] + '</td>';
result += '<td class="data PlanID">'+ thisClmStats.fields["ClaimAverage4"] + '</td>';
result += '<td class="data PlanID">'+ thisClmStats.fields["PercentageofTOTALVolume4"] + '</td>';
result += '<td class="data PlanID">'+ thisClmStats.fields["Paid4"] + '</td>';
result += '<td class="data PlanID">'+ thisClmStats.fields["Pending4"] + '</td>';
result += '<td class="data PlanID">'+ thisClmStats.fields["Denied4"] + '</td>';
result += '</tr>';
}
}
this.after(result);
});
I am a beginner in javascript. I have researched the forum for answers to my question. there were a couple that I think I could have used except with my code I am, not sure where or how to put it. Can someone help me? I need to show the eight rows right aligned. Thank you !!!
results.each(function(index) {
var result = "";
var theseClmStats = record.tables.PlanClmStats[index].tables.ClmStats;
var thisPlanClmStats = record.tables.PlanClmStats[index];
//query("#test").append(thisPlanClmStats.fields["PlanName"]+ " (" + index + ') has ' + thisPlanClmStats.tables.length +' table(s)<br/>');
if(thisPlanClmStats.fields.PlanId != null) {
theseClaimSource = thisPlanClmStats.tables.ClmStats.ClaimSource;
result += '<tr data-repeat="" data-breakable="ClaimSource' + index +'">';
result += '</tr>';
var ClmStatslen = theseClmStats.length;
for (var i=0; i < ClmStatslen; i++) {
var thisClmStats = theseClmStats[i];
result += '<tr data-repeat="" data-breakable="ClmStats' + i +'">';
result += '<td><br/></td>';
result += '<td class="data PlanID" textAlign:right>'+ thisClmStats.fields["ClaimSource"] + '</td>';
result += '<td class="data PlanID">'+ thisClmStats.fields["UniqueParticipants4"] + '</td>';
result += '<td class="data PlanID">'+ thisClmStats.fields["ClaimVolume4"] + '</td>';
result += '<td class="data PlanID">'+ thisClmStats.fields["ClaimAverage4"] + '</td>';
result += '<td class="data PlanID">'+ thisClmStats.fields["PercentageofTOTALVolume4"] + '</td>';
result += '<td class="data PlanID">'+ thisClmStats.fields["Paid4"] + '</td>';
result += '<td class="data PlanID">'+ thisClmStats.fields["Pending4"] + '</td>';
result += '<td class="data PlanID">'+ thisClmStats.fields["Denied4"] + '</td>';
result += '</tr>';
}
}
this.after(result);
});
Share Improve this question asked Oct 27, 2016 at 16:07 AmyAmy 211 gold badge1 silver badge2 bronze badges1 Answer
Reset to default 3You seem to be mixing a bunch of concepts together. To make the text right-align in a table cell (<td>
), you could just apply CSS to one of the classes you are using, such as:
<style type="text/css">
td.PlanID {text-align:right}
</style>
Then, when you append the HTML, the CSS will automatically be applied.
If you can't adjust the CSS file (or HTML file), then try adding to your JS:
document.getElementsByClassName("PlanID").style.textAlign= "right";
You would then add this line at the end of your Javascript. But it probably is better (and cleaner) to use the CSS method.