Ciao,
qui creo una tabella con dati presi da "runs#data". "runs#data" ha 3 campi.
Adesso dovrei aggiungere alla tabella un quarto campo, definirle un titolo thead e poi i valori body come field4 = field1-field2
Come posso fare?
Grazie
codice:var runs = {}; // hold the table runs.data_container = d3.select("div#Runs_Data") .classed("row", true); runs.table = runs.data_container.append("div") .classed("col-xs-12", true) .append("table") data = d3.csv.parse(d3.select("runs#data").text()); runs.labels = d3.keys(data[0]); runs.header = runs.table.append("thead") runs.headers = runs.header.append("tr") .selectAll("th") .data(runs.labels).enter() .append("th") .text(function(d){ return d; }) .attr("data-sortable",true) .attr("data-field",function(d){ return d; }) runs.table.attr({ "data-sort-name": runs.labels[0], "data-sort-order": "asc", "data-striped": true }); rows = runs.table .append("tbody") .selectAll("tr") .data(data) .enter() .append("tr") cells = rows.selectAll("td") .data(function(row){ return runs.labels.map(function(d){ return row[d]; }); }) .enter() .append("td") .text(function(d){ return d; }) $(runs.table.node()).bootstrapTable()

Rispondi quotando