i’ve made an HtmlTable.Select in mootools 1.3 of an existing table, tried “selectable: true” and “enableSelect”, nothing works, if i try to access the “getSelected”-method of my table, i keep getting “.getSelected is not a function”, all other functions like “selectAll” or “selectNone” work perfectly”.
my code (from inside my class):
this.options.HTMLTable = new HtmlTable(this.options.table, {
selectable : true
});
// this works perfect ...
this.options.HTMLTable.selectAll();
// ... but this causes the error!
console.log(this.options.HTMLTable.getSelected());
can you help?
I’m not a mooTools expert but if you check this jsfiddle
You will see that in the prototype (
.__proto__) ofthis.options.HTMLTablethe methodselectAllis defined butgetSelectedis not.This is a start to your debugging. Add some data to the fiddle to make it more realistic of your issue.
There’s a
._selectedRowsproperty on HTMLTable though. just write your own .getSelected method and be done with it!I just read the source code and the method
getSelecteddoesn’t exist. Here’s what it should doFile it as a bug and in the meanwhile just use
As @DimitarChristoff recommended your better off using:
This way you only change the prototype of HtmlTable if it’s neccessary. You might need some kind of HtmlTable.Select is loaded check.
See new fiddle