-
28 Oct 2007 10:29 PM #1
New Component in ext
New Component in ext
hi all,
Iam very new to ext technology. i would like to add a new custumized component to ext (to learn ext structure & style of coding). so i just tried to make a copy of TextField, by copying it and renamed it to TextFiels1. But when i call this component in jsp shows error like TextFiels1 is not a cunstructor.
following are the file contents.
TextField1.js in lib/ext/source/widget/form
Ext.form.TextField1 = function(config){
Ext.form.TextField1.superclass.constructor.call(this, config);
//like this i have edited all 'Ext.form.TextField' to 'Ext.form.TextField1'
.
.
Ext.reg('textfield', Ext.form.TextField1);
modules/myModule/script/userList.js
modules.myModule.UserList=function(){
var pagingToolBar=new Ext.PagingToolbar({
store: store,
pageSize: 10,
displayInfo: true,
displayMsg: 'Topics {0} - {1} of {2}',
emptyMsg: "No topics to display"
});
grid = new Ext.grid.GridPanel({
el:'userListTable',
ds: store,
cm: cModel,
bbar: tool,
tbar:pagingToolBar,
height:280,
width:650,
loadMask: true
});
return{
init :function(){
var charField=new Ext.form.Text(Form1{emptyText: "Enter User Name or email"});//error :Ext.form.TextFiels1 is not a constructor pagingToolBar.addField(charField);
},
};
}();
Ext.onReady(modules.myModule.UserList.init(),modules.myModule.UserList);
Please send me some solution to this probles.
Last edited by mystix; 28 Oct 2007 at 10:32 PM. Reason: moved to 1.x Help from 1.x Bugs
-
28 Oct 2007 10:33 PM #2
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
-
29 Oct 2007 1:21 AM #3
In your source are some confusing errors, I assume that you made an error durring your post... However if you are interested to establish your own classes then try this:
BrCode:Ext.namespace('Ext.ux.wak'); Ext.ux.wak.TextField = Ext.extend(Ext.form.TextField, { emptyText: 'This field is mandatory', initComponent: function(){ Ext.ux.wak.TextField.superclass.initComponent.call(this); } }); Ext.onReady(function(){ var frmTest = new Ext.FormPanel ({ labelWidth: 75, url:'#', frame:true, title: 'Simple Form', bodyStyle:'padding:5px 5px 0', width: 350, defaults: {width: 230}, items: [ new Ext.ux.wak.TextField ({ fieldLabel: 'Field 1', name: 'f1' }), new Ext.ux.wak.TextField ({ fieldLabel: 'Field 2', name: 'f2' }) ] }); frmTest.render(document.body); });
Wolfgang


Reply With Quote