Zoradíš dvojice [x, y], vygeneruješ tabuľku a zobrazíš:
1) Pre pridávanie riadkov a stĺpcov a ich plnenie hodnotami potrebuješ document.createElement, document.appendChild a document.createTextNode.
2) Ako preniesť hodnoty do premennej z tabuľky? Nerozumiem otázke. Ak chceš zmeniť napr. text v bunke tabuľky, použiješ metódu replaceChild alebo zmeníš priamo vlastnosť data.
3) Na mazanie môžeš použiť removeChild.
Treba tabuľku meniť postupne - nestačí ju po zmene hodnôt jednoducho pregenerovať?
Napr. (predpokladám, že v dokumente je stará tabuľka s id="table"):
function refreshTable ()
{
// dvojice [x, y]
var hodnoty = [[7, 9], [12, 11],[3,12],[33,10],[55,13],[14,2]];
// zoradenie dvojic
hodnoty.sort (function (a, b) {return (a [1] - b [1]);})
// vytvorenie tabulky
var table, tbody, tr, td;
table = document.createElement ("table");
table.id = "table";
table.border = 1;
table.appendChild (tbody = document.createElement ("tbody"));
for (var j = 0; j < hodnoty.length; ++j)
{
tbody.appendChild (tr = document.createElement ("tr"));
for (var i = 0; i < hodnoty [j].length; ++i)
{
tr.appendChild (td = document.createElement ("td"));
td.appendChild (document.createTextNode (hodnoty [j] [i]));
}
}
// nahradenie starej tabulky novou
var el = document.getElementById ("table");
el.parentNode.replaceChild (table, el);
}