this.up() is not function EXTJS
up vote
0
down vote
favorite
I want submit my data to server ffrom controller.
It is particullart controller code:
renterForms: function() {
var items3 = [{
xtype:'foresto-renterdata',
scrollable: true,
scope: this,
renderTo: 'mainPart',
handler: function() {
this.action3.hide();
}
},{
text: 'Submit',
ui: 'confirm',
scope: this,
handler: function() {
var form = this.up('foresto-rentertype');
if (form.isValid()) {
form.submit({
success: function(form, action) {
Ext.Msg.alert('Success', action.result.msg);
},
failure: function(form, action) {
Ext.Msg.alert('Failed', action.result.msg);
}
});
} else { /
Ext.Msg.alert('Error', 'Please correct form errors.')
}
}
in chrome debuger i see next error: Uncaught TypeError: this.up is not a function. What is wrong? This good way to get and submit data?
P.S. url for POST request define in code of form
javascript extjs web-applications extjs4 sencha-touch
add a comment |
up vote
0
down vote
favorite
I want submit my data to server ffrom controller.
It is particullart controller code:
renterForms: function() {
var items3 = [{
xtype:'foresto-renterdata',
scrollable: true,
scope: this,
renderTo: 'mainPart',
handler: function() {
this.action3.hide();
}
},{
text: 'Submit',
ui: 'confirm',
scope: this,
handler: function() {
var form = this.up('foresto-rentertype');
if (form.isValid()) {
form.submit({
success: function(form, action) {
Ext.Msg.alert('Success', action.result.msg);
},
failure: function(form, action) {
Ext.Msg.alert('Failed', action.result.msg);
}
});
} else { /
Ext.Msg.alert('Error', 'Please correct form errors.')
}
}
in chrome debuger i see next error: Uncaught TypeError: this.up is not a function. What is wrong? This good way to get and submit data?
P.S. url for POST request define in code of form
javascript extjs web-applications extjs4 sencha-touch
make thathandlerfunction an arrow function instead, to preserve thethisof the surrounding scope
– Robin Zigmond
yesterday
if you don't mind please show how it should look like
– Tyomik_mnemonic
yesterday
1
instead ofhandler: function() {...}dohandler: () => {...}. See developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…
– Robin Zigmond
yesterday
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I want submit my data to server ffrom controller.
It is particullart controller code:
renterForms: function() {
var items3 = [{
xtype:'foresto-renterdata',
scrollable: true,
scope: this,
renderTo: 'mainPart',
handler: function() {
this.action3.hide();
}
},{
text: 'Submit',
ui: 'confirm',
scope: this,
handler: function() {
var form = this.up('foresto-rentertype');
if (form.isValid()) {
form.submit({
success: function(form, action) {
Ext.Msg.alert('Success', action.result.msg);
},
failure: function(form, action) {
Ext.Msg.alert('Failed', action.result.msg);
}
});
} else { /
Ext.Msg.alert('Error', 'Please correct form errors.')
}
}
in chrome debuger i see next error: Uncaught TypeError: this.up is not a function. What is wrong? This good way to get and submit data?
P.S. url for POST request define in code of form
javascript extjs web-applications extjs4 sencha-touch
I want submit my data to server ffrom controller.
It is particullart controller code:
renterForms: function() {
var items3 = [{
xtype:'foresto-renterdata',
scrollable: true,
scope: this,
renderTo: 'mainPart',
handler: function() {
this.action3.hide();
}
},{
text: 'Submit',
ui: 'confirm',
scope: this,
handler: function() {
var form = this.up('foresto-rentertype');
if (form.isValid()) {
form.submit({
success: function(form, action) {
Ext.Msg.alert('Success', action.result.msg);
},
failure: function(form, action) {
Ext.Msg.alert('Failed', action.result.msg);
}
});
} else { /
Ext.Msg.alert('Error', 'Please correct form errors.')
}
}
in chrome debuger i see next error: Uncaught TypeError: this.up is not a function. What is wrong? This good way to get and submit data?
P.S. url for POST request define in code of form
javascript extjs web-applications extjs4 sencha-touch
javascript extjs web-applications extjs4 sencha-touch
asked yesterday
Tyomik_mnemonic
346
346
make thathandlerfunction an arrow function instead, to preserve thethisof the surrounding scope
– Robin Zigmond
yesterday
if you don't mind please show how it should look like
– Tyomik_mnemonic
yesterday
1
instead ofhandler: function() {...}dohandler: () => {...}. See developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…
– Robin Zigmond
yesterday
add a comment |
make thathandlerfunction an arrow function instead, to preserve thethisof the surrounding scope
– Robin Zigmond
yesterday
if you don't mind please show how it should look like
– Tyomik_mnemonic
yesterday
1
instead ofhandler: function() {...}dohandler: () => {...}. See developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…
– Robin Zigmond
yesterday
make that
handler function an arrow function instead, to preserve the this of the surrounding scope– Robin Zigmond
yesterday
make that
handler function an arrow function instead, to preserve the this of the surrounding scope– Robin Zigmond
yesterday
if you don't mind please show how it should look like
– Tyomik_mnemonic
yesterday
if you don't mind please show how it should look like
– Tyomik_mnemonic
yesterday
1
1
instead of
handler: function() {...} do handler: () => {...}. See developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…– Robin Zigmond
yesterday
instead of
handler: function() {...} do handler: () => {...}. See developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…– Robin Zigmond
yesterday
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
scope: this
this is the actual issue which is messing up with scope inside handler function. Remove it and it will resolve the up function.
You can see the behavior with scope with following example fiddle:
https://fiddle.sencha.com/#view/editor&fiddle/2nhv
When "scope: this" is defined, then scope while building the component will be used and injected inside the handler function. It is equivalent to explicitly writing handlerFn.bind(this) which simply binds the different scope and returns a new function.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
scope: this
this is the actual issue which is messing up with scope inside handler function. Remove it and it will resolve the up function.
You can see the behavior with scope with following example fiddle:
https://fiddle.sencha.com/#view/editor&fiddle/2nhv
When "scope: this" is defined, then scope while building the component will be used and injected inside the handler function. It is equivalent to explicitly writing handlerFn.bind(this) which simply binds the different scope and returns a new function.
add a comment |
up vote
0
down vote
scope: this
this is the actual issue which is messing up with scope inside handler function. Remove it and it will resolve the up function.
You can see the behavior with scope with following example fiddle:
https://fiddle.sencha.com/#view/editor&fiddle/2nhv
When "scope: this" is defined, then scope while building the component will be used and injected inside the handler function. It is equivalent to explicitly writing handlerFn.bind(this) which simply binds the different scope and returns a new function.
add a comment |
up vote
0
down vote
up vote
0
down vote
scope: this
this is the actual issue which is messing up with scope inside handler function. Remove it and it will resolve the up function.
You can see the behavior with scope with following example fiddle:
https://fiddle.sencha.com/#view/editor&fiddle/2nhv
When "scope: this" is defined, then scope while building the component will be used and injected inside the handler function. It is equivalent to explicitly writing handlerFn.bind(this) which simply binds the different scope and returns a new function.
scope: this
this is the actual issue which is messing up with scope inside handler function. Remove it and it will resolve the up function.
You can see the behavior with scope with following example fiddle:
https://fiddle.sencha.com/#view/editor&fiddle/2nhv
When "scope: this" is defined, then scope while building the component will be used and injected inside the handler function. It is equivalent to explicitly writing handlerFn.bind(this) which simply binds the different scope and returns a new function.
answered 1 hour ago
Saurabh Nemade
953514
953514
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53204369%2fthis-up-is-not-function-extjs%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
make that
handlerfunction an arrow function instead, to preserve thethisof the surrounding scope– Robin Zigmond
yesterday
if you don't mind please show how it should look like
– Tyomik_mnemonic
yesterday
1
instead of
handler: function() {...}dohandler: () => {...}. See developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…– Robin Zigmond
yesterday