Custom Painting with the JS DOM?
Posted: Tue Feb 27, 2007 7:35 am
I want to create an object which extends HTMLTableElement. Does anyone know if it's possible?
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:
Or something to that effect. Anyone have an hints? I tried this but it just seems to destroy my class.
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");