来源http://www.akbkhome.com/blog.php/View/137/Developing_with_Extjs__tricks_and_tips.html
[b]定义对象:[/b]
下面是定义对象简单方式:
aaa = {
ccc: "test",
bbb : function() {
alert(this.cc);
}
}
aaa.bbb();
定义对象私有变量可以这样:
aaa = (function () {
var myprivate;
return {
setIt: function(val) {
myprivate = val;
}
getIt: function() {
return myprivate;
}
}
})();
用Ext.extend来扩展对象
function MyCombo (config) {
// set up your datasource here..
MyCombo.superclass.constructor.call(this,config);
}
Ext.extend(MyCombo, Ext.form.ComboBox, {
displayField:'title',
typeAhead: true,
loadingText: 'Searching...',
forceSelection: true,
allowBlank: false,
width: 160,
minChars: 1,
pageSize:10,
hideTrigger:true,
displayField: 'FullName',
valueField: 'id'
}
[b]定义对象:[/b]
下面是定义对象简单方式:
aaa = {
ccc: "test",
bbb : function() {
alert(this.cc);
}
}
aaa.bbb();
定义对象私有变量可以这样:
aaa = (function () {
var myprivate;
return {
setIt: function(val) {
myprivate = val;
}
getIt: function() {
return myprivate;
}
}
})();
用Ext.extend来扩展对象
function MyCombo (config) {
// set up your datasource here..
MyCombo.superclass.constructor.call(this,config);
}
Ext.extend(MyCombo, Ext.form.ComboBox, {
displayField:'title',
typeAhead: true,
loadingText: 'Searching...',
forceSelection: true,
allowBlank: false,
width: 160,
minChars: 1,
pageSize:10,
hideTrigger:true,
displayField: 'FullName',
valueField: 'id'
}