-
27 Nov 2012 4:48 AM #1
Unanswered: Uncaught Error: Ext.setup has already been called before
Unanswered: Uncaught Error: Ext.setup has already been called before
Hallo i have a program, which has a Login Panel and after the Login it has to show me another View. I would like to switch after login to the Ext.ux.touch.grid.
https://github.com/mitchellsimoens/Ext.ux.touch.grid
i have a LoginView. a Controller which looks like:
Ext.define("Login.controller.MainController",{
extend:'Ext.app.Controller',
views:['LoginView', 'HauptSeite', 'index'],
//--------------------------------------------------------refs, control
refs:[{ loginSeite :'#loginForm'}],
init: function(){
console.log('inited');
this.control({
'button[action=submitkontakt]': {
tap:'submitkontaktForm'
}
});
},
//--------------------------------------------------------refs, control
//definition von "submitgridForm"
submitkontaktForm:function(btn){
var form=btn.up('formpanel');
//console.log(form);
form.submit({
url:'login.php',
success : function(form, res){
console.log('right');
Ext.Viewport.setActiveItem(Ext.create('LoginAufGrid.view.index'));
alert('You are logged in');
},
failure : function(form, res){
console.log('false');
alert('wrong Login');
}
})
},
});
this part: Ext.Viewport.setActiveItem(Ext.create('LoginAufGrid.view.index')); should give a new View of Ext.ux.touch.grid.
I try to change the index.js of Ext.ux.touch.grid, so maybe it can work, but i can't find a solution.
I get allways the Error: Uncaught Error: Ext.setup has already been called before.
How can i change the part of :
Please help meExt.setup({
onReady:function(){

Thanks
-
27 Nov 2012 6:48 AM #2
ok i have the solution :-)
I copy the content from index.js of : https://github.com/mitchellsimoens/Ext.ux.touch.grid
but i changed the index.js bevor, therefore it looks different.
i copy my index.js in a class => Page2.js and there ist now:
Ext.define("Login.view.Page2", {
extend: 'Ext.Container',
initialize:function(){
Ext.define('TestModel', {
extend : 'Ext.data.Model',
config : {
fields : [
'name',
'zahl',
'einzugstermin'
]
}
});
var store = Ext.create('Ext.data.Store', {
model : 'TestModel',
autoLoad : true,
data : [
{ name : 'b', zahl : 71.72, einzugstermin : '9/1/2010' },
{ name : 'a', zahl : 72.72, einzugstermin : '9/1/2010' },
{ name : 'r', zahl : 73.72, einzugstermin : '9/1/2010' },
{ name : 'd', zahl : 70.72, einzugstermin : '9/1/2010' }
]
});
var grid = Ext.create('Ext.ux.touch.grid.List', {
height : 300,
store : store,
features : [
{
ftype : 'Ext.ux.touch.grid.feature.Sorter',
launchFn : 'initialize'
}
],
columns : [
{
header : 'Name',
dataIndex : 'name',
style : 'padding-left: 1em;',
width : '40%',
filter : { type : 'string' }
},
{
header : 'Zahl',
dataIndex : 'zahl',
style : 'text-align: center;',
width : '15%',
filter : { type : 'numeric' }
},
{
header : 'Einzugstermin',
dataIndex : 'einzugstermin',
cls : 'centered-cell redgreen-cell',
width : '15%',
renderer : function (value) {
var cls = (value > 0) ? 'green' : 'red';
return '<span class="' + cls + '">' + value + '</span>';
}
}
]
});
this.add( grid);
store.load();
}
});
and in the Controller i can call it with => Ext.Viewport.setActiveItem(Ext.create('Login.view.Page2'));
and it works :-)submitkontaktForm:function(btn){
var form=btn.up('formpanel');
//console.log(form);
form.submit({
url:'login.php',
success : function(form, res){
console.log('right');
Ext.Viewport.setActiveItem(Ext.create('Login.view.Page2'));
alert('You are logged in');
},
failure : function(form, res){
console.log('false');
alert('wrong Login');
}
})
},


Reply With Quote