I am new to ExtJS. Trying to use and customize tabs feature in application.
I want to call a function with parameters which is in ExtJs scope from Javascript Scope. Right Now I can call function without passing parameters without getting any errors. When I call same function by passing parameters(mentioned in code), It gives me following error as function is not getting any values.
Uncaught TypeError: Cannot call method 'indexOf' of null
This function should add new tab to tabpanel.
When I call same function by passing parameters from ExtJS scope it is adding tab successully. But not when function get called from javascript scope by passing parameters. Help me to understand and fix this problem.
Ext.onReady(function() {
var currentItem;
var tabs = Ext.widget('tabpanel', {
launch: function() {
_myAppGlobal = this;
},
renderTo: 'tabs',
resizeTabs: true,
enableTabScroll: true,
width: 850,
defaults: {
autoScroll: true,
bodyPadding: 10
}],
plugins: Ext.create('Ext.ux.TabCloseMenu', {
extraItemsTail: [
'-',
{
text: 'Closable',
checked: true,
hideOnClick: true,
handler: function (item) {
currentItem.tab.setClosable(item.checked);
}
},
'-',
{
text: 'Enabled',
checked: true,
hideOnClick: true,
handler: function(item) {
currentItem.tab.setDisabled(!item.checked);
}
}
],
listeners: {
aftermenu: function () {
currentItem = null;
},
beforemenu: function (menu, item) {
menu.child('[text="Closable"]').setChecked(item.closable);
menu.child('[text="Enabled"]').setChecked(!item.tab.isDisabled());
currentItem = item;
}
}
})
});
function addTab_inside(closeable, tabtitle, targetUrl) {
tabs.add({
title: tabtitle,
iconCls: 'tabs',
autoLoad: {url: targetUrl, callback: this.initSearch, scope: this},
closable: closeable,
autoScroll: true,
nocache: true,
discardUrl: false
}).show();
}
});
function addTab_Outside(){
addTab_inside(true, 'Test', 'test.php');
}
addTab_Outside function is event based and getting called onClick on xyz element.