I've got a HTML menu option, which I bind a click
handler in jQuery:
var xyz = {
getMainContainerSelector: function () {
return '.container#main';
},
bindMenuOptions: function () {
$('#menu_outcome_list').bind('click', function() {
// inject template
$(this.getMainContainerSelector()).html(ich.outcomeListTemplate({}));
// load datatable
$('#outcomes').dataTable({
"bServerSide": true,
'sPaginationType': 'bootstrap',
"sAjaxSource": '../php/client/json.php?type=outcomes'
});
});
},
...
}
I've got a problem with the following line:
$(this.getMainContainerSelector()).html(ich.outcomeListTemplate({}));
and I guess it's a context problem. I mean, inside the bind function, this
is not xyz
anymore, but the ('#menu_outcome_list') HTML element. What I want to do is just to call the xyz
's method from inside the bind function.