I think this will work for you. Convert each data row to a Hash so
you can iterate over the values without knowing the keys. That way if
you add more data items you automatically get more table columns to
display them. Here's what I've got:
onSuccess: function(json) {
var list = json.d;
var table = new Element('table', {'width':'100%'});
list.each(function(item) {
var tr = new Element('tr');
// convert the item to a Hash and iterate over the values
$H(item).getValues().each(function(value){
// no need to store the new element in a var (small
performance gain)
new Element('td', { 'text': value }).inject(tr);
});
tr.inject(table);
}.bind(this));
table.inject($(this.options.container));
}.bind(this);