With fnGetData(row), I get back an Object with all my original properties + whatever other custom columns I've defined.
With more and more of my code moving to arrays of complex objects rather than 2d arrays of data, I want to be use the methods available on my 'typed' JS Objects.
So, can I get to my original objects somehow (either using fnGetData or otherwise)? I have factory methods that convert 'plain' objects into instances, but it seems like a waste when those instances already exist somewhere. I've also tried caching my objects in another array and then looking them up when I get the row data from fnGetData....but that makes me feel incompetent ;)
With more and more of my code moving to arrays of complex objects rather than 2d arrays of data, I want to be use the methods available on my 'typed' JS Objects.
function GameUser() { this.name = 'someridiculoushandle'; this.score = 15; } GameUser.prototype.incrementScore = function( ) { this.score += 1; return this; } //paraphrased.... //bind array of GameUser to DataTable aGameUsers = [new GameUser()]; dt.fnAddData(aGameUsers); //click on row data = dt.fnGetData(row)[0]; if(data instanceof GameUser) { //this is false //i want to be able to do this: data.incrementScore(); }
So, can I get to my original objects somehow (either using fnGetData or otherwise)? I have factory methods that convert 'plain' objects into instances, but it seems like a waste when those instances already exist somewhere. I've also tried caching my objects in another array and then looking them up when I get the row data from fnGetData....but that makes me feel incompetent ;)