Results 1 to 2 of 2

Thread: Create reusable component

  1. #1
    Sencha User
    Join Date
    May 2010
    Location
    Belgium
    Posts
    216
    Answers
    4

    Default Create reusable component

    Hello,

    I'm using Extjs 4.2 withount Mvc. I have created a combo and I would like to use in different panels.

    Code:
        CdmStore = new Ext.data.Store({
            fields: [{
                name: 'l_cdm'
            }, {
                name: 'c_cdm'
            }],
            remoteFilter: true,
    
           // autoSync: true,
           //autoLoad: true,
            proxy: {
                type: 'ajax',
                url: 'data/comboTypeMan.cfc?method=getAgent',
                reader: {
                    type: 'json',
                    root: 'data'
                }
            }
        });
        
         cdmManLib = Ext.create('Ext.form.ComboBox', {
            store: comboCdmStore,
            labelAlign: 'top',
            fieldLabel: 'Chef de manoeuvre',
            queryMode: 'remote',  
            selectOnFocus: true,
            name: 'cdmManLib',
            minChars: 2,
                typeAhead: true,
                editable: true,
            width: 270,
            valueField: 'l_cdm',
            displayField: 'l_cdm'
        });
    I was thinking to use Ext.define ... but I think this is work only with the MVC as we use the app name in the define path. However, I do not have an application name in my no MVC app.

    Anyone could give me a clue how to achieve it?

    Thanks in advance,

  2. #2
    Sencha - Sustaining Engineer tristan.lee's Avatar
    Join Date
    Mar 2015
    Location
    Central Ohio
    Posts
    1,579
    Answers
    165

    Default

    There's no need to worry about using the MVC pattern or not, you were on the right track with Ext.define. Here's an example where I defined your component with an xtype of customcombo, and then I can reference that within the form items:

    Tristan Lee
    Sencha Inc - Sustaining Engineer


    Having an issue? Help us help you - be detailed; provide some code; demonstrate with a fiddle (fiddle.sencha.com)

    Embed your fiddle in your post: [FIDDLE]id[/FIDDLE]

Similar Threads

  1. Create reusable components with extjs 4
    By nani1216 in forum Ext: Q&A
    Replies: 4
    Last Post: 12 Nov 2013, 9:55 AM
  2. reusable Component parameters
    By pdm in forum Sencha Architect 2.x: Help & Discussions
    Replies: 0
    Last Post: 16 Aug 2012, 7:39 AM
  3. Replies: 2
    Last Post: 22 Nov 2011, 3:44 PM
  4. patterns to create reusable custom components
    By [email protected] in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 12 Sep 2008, 1:15 AM
  5. My reusable component...
    By Rocco in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 18 Jan 2008, 8:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •