Anonymous functions are commonly used in event callbacks, they are not so convenient to be called at will.
Please use following ways:
1. use an initialization object.
//obj is initialization object.
var obj = {
width: "80%",
height: 400,
title: "Grid From JSON",
create: function create(){
alert('create');
},
toolbar: {
items:[
{
type:'button',
label:'call create',
listener: function(){
obj.create.call(this);
}
}
]
},
scrollModel: { autoFit: true },
dataModel: { data: data }
};
2. Abstract the common functionality into a named function and then you can call the functions by their names.
3.
listener: function(){
this.option('create').call(this);
}