ExtJS Custom Component Function Callback instance Introduction

Source: Internet
Author: User

The engineering uses Sencha ExtJs, because of the specific component reason that causes many components to be themselves. The success_callback after the component definition has been completed because it has not been done before, so write it down for later review. Directly on the code:

Interface call

The code is as follows Copy Code
<script type= "Text/javascript" >
function aaa () {
var student_panel = new WX.student.AddStudent ({
Incoming callback function, shown directly.
Callback_fun:function () {
Alert (' I am the callback function for the interface ');
}
). Show ();
}
</script>

Component Part Code

The code is as follows Copy Code

Ext.define (' WX.student.AddStudent ', {

Extend: ' Ext.window.Window ',

Modal:true,
height:585,
width:684,
Layout: {
Type: ' Fit '
},
Title: ' New Students ',
Bodypadding: ' 10 10 10 10 ',
For component function callbacks
Callback_fun:function () {},
Initcomponent:function () {
var me = this;
......
Panel component
buttons:[{
Text: ' Save ',
Handler:function () {
Send AJAX requests to save user data.

Custom callback function after call to store
This.callback_fun
}
}]
}

..... Here the approach is similar to Java interface callback, in the custom module to define methods, provide button callback, interface initialization component in the method to overwrite the callback method in the component, to achieve the purpose of the callback.

All right, about ExtJS. Custom Component function Callback here, if you don't understand, you can refer to other articles.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.