I can do it another way, I just like the way it would interface.
I have MarkBook (an object which will be a sublass of HTMLTableElement), MarkBookModel and MarkBookColumnModel. MarkBook is the view which renders the model of course.
If I could have MarkBook as a subclass of HTMLTableElement I could do something like this:
Code: Select all
var markbook = new MarkBook(new MarkBookModel(data));
document.getElementById("something").appendChild(markbook);
// ... SNIP ...
//some user actions etc...
// ... SNIP ...
markbook.getModel().getColumn(i).setValueAt(key, newValue);
markbook.repaint();
Code: Select all
function MarkBook(model)
{
//
}
MarkBook.prototype = document.createElement("table");