I have a MessageHelper object which has a idx var. Now I want to access and modify it from index method. I thought that 'this' would do but I'm getting NaN. Any clue?
var MessageHelper = {
idx: 8,
formatDate: function(){
return function(text, render) {
// // parse date
var date = $.trim(render(text));
var mom = moment(date);
return mom.format("D/M/YY");
}
},
formatDateTime: function(){
[...]
},
getImportance: function(){
[...]
},
index: function(){
return function(text, render) {
this.idx++;
return this.idx;
}
}
}