-
15 Nov 2012 11:36 PM #1
Unanswered: How to use a custom component
Unanswered: How to use a custom component
Hello all,
Am trying to build a reusable component, but i observered that i cannot reuse it. my fire bug displays j is undefined.
this is my code.
And this is where i want to use it...Code:Ext.define('MyGridForm', { extend: 'Ext.container.Container', alias: 'widget.gridform', height:600, width:'100%', constructor: function(config){ Ext.apply(this, { items: [ { xtype:'form', title: 'panel 1', width:50, height:50, items:[ { xtype:'textfield', label:'First Name' } ] }, { xtype:'grid', width:50, height:50, columns:[ { header:'SERVICE TYPE' }, { header:'DESCRIPTION' }, { header:'AMOUNT(N)' } ] }, ] }); this.callParent(arguments); } });
From the view of this code is there something am not doing right?Code:Ext.create('GridForm',{ height:100, width:100 }) or Ext.create('Ext.container.Container',{ height:500, width:'100%', items:[ {} xtype:'gridform' ] })
Please any contribution will be appreciated.
Thanks in advance.
Pat.
-
19 Nov 2012 9:07 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
- Answers
- 3101
Your class name is MyGridForm so it needs to be Ext.create('MyGridForm', {Code:Ext.create('GridForm',{ height:100, width:100 })
-----
That's just not valid JavaScript. It needs to be:Code:Ext.create('Ext.container.Container',{ height:500, width:'100%', items:[ {} xtype:'gridform' ] })
And you probably need to give the Container a layout.Code:Ext.create('Ext.container.Container', { height:500, width:'100%', items:[ { xtype: 'gridform' } ] })Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.



Reply With Quote