I am trying to sort a Table with dynamic data by selecting a radio button.
I can access the data in my table this array:
var arr = [];
for (var i = 0; i < tbl.children.length; i++)
{
var j = i +1;
var cell1 = document.getElementById("tbl_"+container_element.id).childNodes[i].cells[0].textContent;
var cell2 = document.getElementById("tbl_"+container_element.id).childNodes[i].cells[1].textContent;
var cell3 = document.getElementById("tbl_"+container_element.id).childNodes[i].cells[2].textContent;
//arr[i] = [{"cn":cell1, "pr":cell2, "ch":cell3}];
arr[cell1] = {
cn: cell1,
pr: cell2,
ch: cell3
};
}
console.log(arr['Name of Object']);
So I can access on particular row by setting a name from the array so I can access the properties in that object.
How do I sort my table by referring to one of those propeties? That way if I have multiple radio buttons, I can sort by different properties.