Arkitech

Best option - Query results in grid or dump to html

Discussion created by Arkitech on Nov 8, 2013
Latest reply on Nov 8, 2013 by btfou
Hi

So my application is now functional and working but i would like to tweak the output.

my code works to get my querytask and passes the results:

function showResults(results) {
          var s = "";
          var aliases = results.fieldAliases;
          var len = results.features.length;
            if (len === 0) { // if no results
             s = "No results for this IPMS reference: " + IPMSREF
             console.log(s);
            } else { // if 1 or more results, display them
             for (var i = 0; i < len; i++) {
            var featureAttributes = results.features[i].attributes;
              for (att in featureAttributes) {
                s = s + "<b>" + (aliases.hasOwnProperty(att) && aliases[att]) + "</b>" + ": " + featureAttributes[att] + "<br>";
            }
            s = s + "<br>";
            }        
          }
           dom.byId("info").innerHTML = s;
        };


It currently looks find but i would like to style each attribute with a even/odd colour. I remember doing this a while back with a easier option in html depending on a return boolean but this is a bit tricker.

Would it be easier to put it into a grid and then style or can i style each line without doing grids?

thanks

Outcomes