Results 1 to 3 of 3

Thread: Reusable control, passing data and dynamic store

  1. #1
    Sencha User
    Join Date
    Oct 2015
    Posts
    37
    Answers
    1

    Default Answered: Reusable control, passing data and dynamic store

    Hey,


    I'm trying to encapsulate control (for instance ComboBox) and would like to configure it once and reuse it in different controls. How can I achieve that?

    Here is fiddle (not working because of parameters): https://fiddle.sencha.com/#fiddle/13li

    Tried to add schema with api into it, but no luck with that.

    Code:
    Ext.define('Fiddle.view.CustomComboBoxBase', {
        extend: 'Ext.form.ComboBox',
        xtype: 'CustomComboBoxBase',
        
        // Store
        store: Ext.create('Ext.data.Store', {
            fields: {$MyCustomDataTwo},
            proxy: {
                type: 'ajax',
                url: '/{$MyCustomDataOne}/GetComboBoxData',
                reader: {
                    type: 'json',
                    rootProperty: 'data'
                }
            }
        })
    });
    And use it control like this:
    Code:
    Ext.define('Fiddle.view.SomeKindOfView', {
        extend: 'Ext.container.Container',
        alias: 'widget.SomeKindOfView',
        
        items: [
            {  xtype: 'CustomComboBoxBase', MyCustomDataOne: 'users', MyCustomDataTwo: ['UserId', 'UserName']} 
            
            ]
    });

  2. Hi--

    You could do this by setting up the config for the store within the initComponent() for your component class:

    https://fiddle.sencha.com/#fiddle/13lo

    Thanks!
    Joel

  3. #2
    Sencha User
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446

    Default

    Hi--

    You could do this by setting up the config for the store within the initComponent() for your component class:

    https://fiddle.sencha.com/#fiddle/13lo

    Thanks!
    Joel

  4. #3
    Sencha User
    Join Date
    Oct 2015
    Posts
    37
    Answers
    1

    Default

    Thank you!

Similar Threads

  1. Replies: 2
    Last Post: 15 Aug 2013, 3:21 AM
  2. Replies: 1
    Last Post: 2 Mar 2012, 10:10 AM
  3. Dynamic Data Control Type
    By ez_jrepolido in forum Community Discussion
    Replies: 2
    Last Post: 26 Dec 2011, 6:55 PM
  4. Replies: 1
    Last Post: 16 Nov 2011, 1:42 AM
  5. Passing array as data store
    By priyanka_iknip in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 10 Sep 2008, 6:36 AM

Tags for this Thread

Posting Permissions

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