i using javascript loop create table made of figures. code creates table fine , have added styles it. problem having finding way compare data within cell columns in order highlight best , worst performer within group column.
here javascript functions using.
function performancemetricsload() { var records = storeperformancemetricsdata.getrecordsvalues(); var grouptracker = null; var assettracker = null; var htmlstr; htmlstr = "<table class='tablestyles'><thead class='headerstyles'><tr><th width='400'>name</th><th width='110'>1 month cumulative performance " + records[0].datetimerecorded.format("f j, y") + "</th><th width='110'>3 month cumulative performance " + records[0].datetimerecorded.format("f j, y") + "</th><th width='110'>6 month cumulative performance " + records[0].datetimerecorded.format("f j, y") + "</th><th width='110'>12 month cumulative performance " + records[0].datetimerecorded.format("f j, y") + "</th></tr></thead><tbody>"; (var = 0; < records.length; i++) { if (grouptracker != records[i].classoption) { htmlstr += "<tr>" + "<td class='groupstylecss' colspan='5'>" + records[i].diversification + "</td></tr>"; grouptracker = records[i].classoption; } if (grouptracker == records[i].classoption) { htmlstr += "<tr>" + "<td class='recordcssstyle'>" + records[i].assetlongname + "</td>"+ "<td class='recdiv'>" + records[i].totalreturn1m.tofixed(2) + "</td>" + "<td class='recdiv'>" + records[i].totalreturn3m.tofixed(2) + "</td>" + "<td class='recdiv'>" + records[i].totalreturn6m.tofixed(2) + "</td>" + "<td class='recdiv'>" + records[i].totalreturn12m.tofixed(2) + "</tr>"; assettracker = records[i].assetlongname; } } htmlstr += "</tbody></table>"; createrow("", htmlstr); frmmetrics.dolayout(); }
function createrow(cls, text) { frmmetrics.add(new ext.boxcomponent({ cls: cls, html: "<div>" + text + "</div>" })); }
the information output ext formpanel.
the problem have have outputting information need find way highlight best , worst performers within columns, within groupings...
the table outputs 5 columns along top, , 10 groups down left hand side of fund names grouped 'diversification', depending on information requested using sql query.
does have idea of way current state of piece of code? thinking using external function , possibly if statements selecting different css classes...any appreciated. many thanks.
sorry lack of screenshots, tried include apparently need reputation score of 10 before can, or along lines...
add these 2 lines top of function
var largest; var smallest; then in loop, add:
if(value > largest){ largest = value; } if(value < smallest){ smallest = value; } if want add styles cells values add in line store index of values (updated in same way) , set or , select id css.
Comments
Post a Comment