Reputation: 409
How can I call getView(
view_name)` in Sencha touch? I usually do this on extjs but I can't in sencha touch. I could not understand the application concept.
run_edit: function(data) {
$this = this;
this.mode = "update";
this.data = data;
this.win = this.getView('Group_prop').create();
var form = this.win.down('form');
var util = this.getController('controller_Helper');
form.getForm().loadRecord(data);
util.form_lock({
form:form,
items:['GROUP_KODE']
});
util.form_require({
form:form,
items:['GROUP_KODE','GROUP_NAMA']
});
this.win.show();
},
Upvotes: 0
Views: 7704
Reputation: 2969
Ok so it seems like you are trying to get the view: Group_prop
. Make sure this view has an id
or preferably an itemId
set in its config. e.g
Ext.define('MyApp.view.GroupProb', {
extend: 'Ext.Panel',
alias: 'widget.group_prob',
config: {
...
itemId: 'groupProb',
...
},
....
});
Now in your controller you need to create a reference for this view to access it properly. So your controller would look something like this:
Ext.define('MyApp.controller.MyController', {
extend: 'Ext.app.Controller',
config: {
refs : {
groupProb : {
autoCreate: true,
selector: '#groupProb',
xtype: 'group_prob'
}
},
control: {
...
},
...
},
run_edit: function(data) {
$this = this;
this.mode = "update";
this.data = data;
this.win = this.getView('Group_prop').create();
var form = this.win.down('form');
var util = this.getController('controller_Helper');
form.getForm().loadRecord(data);
util.form_lock({
form:form,
items:['GROUP_KODE']
});
this.win.show();
},
...
});
Now from your run_edit
function, its seems like you are working with windows
from the this.win
variable (correct me if I'm wrong). Well in Sencha Touch, you work with Panels
. Also at the end of this function you call the show
function on this.win
, which suggests that you want to execute run_edit
when the this.win
is shown. That being said, you may want to your run_edit
function to look something like this:
run_edit: function() {
var me = this,
mode = 'update',
data = data,
groupProbPanel = me.getGroupProb();
// This assumes that your form component has an itemId.
// You need one inorder use the down method.
var form = groupProbPanel.down('#form_itemId');
// You may want to double check this. I don't think that is how you
// you get the controller.
var util = this.getController('controller_Helper');
form.getForm().loadRecord(data);
util.form_lock({
form:form,
items:['GROUP_KODE']
});
}
Since we want this to happen when groupProbPanel
is shown we need to set a show event listener in our control
config. So your controller's config
should look like this:
...,
config: {
refs : {
groupProb : {
autoCreate: true,
selector: '#groupProb',
xtype: 'group_prob'
}
},
control: {
groupProb : {
show: 'run_edit'
},
...
},
...
},
...
Upvotes: 0
Reputation: 2962
Two ways is there to call the Views
1.
Ext.Viewport.setActiveItem({xtype:'TwowayMakePayment'}); // view xtype
2.
var getti=Ext.create('VUCFyn.view.AfterLogin'); //create object 4 d view
Ext.Viewport.add(getti); // next add the object
Ext.Viewport.setActiveItem(getti); // final Active that obj
Upvotes: 0
Reputation: 5021
I see you are trying to create a view and set it to window, in sencha touch you can do it like this:
Ext.Viewport.add(Ext.create('MyApp.view.ViewName'));
instead of Viewport you can take any other container and set newly created view to it
Ext.getCmp('myContainerId').add(Ext.create('MyApp.view.ViewName'));
to fetch this view later, you have to specify id
config in view and then get it like this:
var view = Ext.getCmp('ViewId');
Upvotes: 1