Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: bind with extended control

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

    Default Answered: bind with extended control

    Hi,

    How can I pass bind to combobox if I have extended it?
    Code:
    { colspan: 1, xtype: 'TestComboBox', bind: '{currentItem.TestId}', name: 'testComboBox' },
    Base level (ComboBoxBase):
    Extendingi ComboBox, no need for code as you can use simple ComboBox for tests.

    Afterbase level:
    Code:
    Ext.define('MyApp.view.myAppControls.MyAppComboBox', {
        extend: 'Ext.container.Container',
    
        xtype: 'MyAppComboBox',
    
        requires: ['MyApp.view.myAppControls.base.ComboBoxBase'],
    
    
    
        layout: {
            type: 'table',
            tableLayout: 'fit'
        },
    
        style: {background: 'red'},
    
        storeFields: null,
        displayField: null,
        valueField: null,
        proxyUrl: null,
    
    
        initComponent: function() {
            var me = this;
    
            me.items = [
                         { colspan: 1, xtype: 'ComboBoxBase', name: 'currentComboBox', proxyUrl: me.proxyUrl, displayField: me.displayField, valueField: me.valueField, storeFields: me.storeFields }
                       ],
    
            me.callParent();
        }
    
    });
    Hihgher level:
    Code:
    Ext.define('MyApp.view.TestComboBox', {
        extend: 'MyApp.view.myAppControls.MyAppComboBox',
    
        xtype: 'TestComboBox',
    
        storeFields: ['TestId', 'TestName'],
        displayField: 'TestName',
        valueField: 'TestId',
        proxyUrl: 'test',
    
    
        initComponent: function () {
            var me = this;
    
            me.items = [
                         {  xtype: 'ComboBoxBase', proxyUrl: me.proxyUrl, displayField: me.displayField, valueField: me.valueField, storeFields: me.storeFields, editable: false }
            ],
    
            me.callParent();
        }
    
    });
    Usage of extended control:
    Code:
    { xtype: 'TestComboBox', bind: '{currentItem.TestId}', name: 'testComboBoxInTestForm'}
    Scenario: I need to make two-way binding for a Form to be able to use extended control. So needed Id would be passed to extend control and back to currentItem. How can I achieve that?

  2. Try this one out:
    https://fiddle.sencha.com/#fiddle/14eg

    Thanks
    Joel

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

    Default

    Bump

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

    Default

    Hi--

    You are wanting to apply the "bind" to the actual combobox (ostensibly to set the value), but you are setting the actual bind on TestComboBox (which I assume is a container of some kind).

    You could pass the bind string as a config, and then set it on the combobox in initComponent(). Alternatively, you could just put the bind statement on the actual combobox.

    Thanks!
    Joel

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

    Default

    Hi,

    I understand that concept and already passing bind string (which is: currentItem.TestId) like this:

    Code:
    { colspan: 1, xtype: 'combobox', bind: me.bindedValue .... }
    Of course it's not working. I guess because it can't find currentItem. Moreover, I need it two-way binding for Form to be able to save that changes. Any hints?

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

    Default

    Without seeing more of your code, it's difficult to say. Can you share a Fiddle with a test case? I'll be happy to test it along with you.

    Thanks
    Joel

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

    Default

    Quote Originally Posted by joel.watson View Post
    Without seeing more of your code, it's difficult to say. Can you share a Fiddle with a test case? I'll be happy to test it along with you.

    Thanks
    Joel
    Hi Joel,

    Here it is: https://fiddle.sencha.com/#fiddle/1457

    Select 'Lisa' (other entries won't work for me for no reason) in grid and press Edit. There is two comboboxes which won't update: Status and User Groups. Now, you can see my problem. I wan't to make those comboboxes two-way binded to entity in a simplest way possible.

    How can I achieve that?

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

    Default

    Are you still happy to test it with me, Joel?

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

    Default

    Here is an example of binding the edit form to the selected record:

    https://fiddle.sencha.com/#fiddle/14bh

    Thanks!
    Joel

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

    Default

    Quote Originally Posted by joel.watson View Post
    Here is an example of binding the edit form to the selected record:

    https://fiddle.sencha.com/#fiddle/14bh

    Thanks!
    Joel
    Have you checked my fiddle? It works fine (again, you must select Lisa) with simple bind on edit and it's not a problem.

    My question is how can I reach that combobox with 'bind' which is extended and is not direct? I spend some time creating that fiddle sample for you, could you have a look into it? I think it should be clear by now what I need as your given sample is completely out of scope...

    Would be amazing if you could give me any hints.

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

Page 1 of 2 12 LastLast

Similar Threads

  1. Extended JsonStore Does Not Bind
    By joevelardi in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 13 Jan 2014, 2:31 PM
  2. Calling methods within an extended control
    By grimbouk in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 29 Sep 2011, 2:13 AM
  3. Is it possible to create an extended EXTJS control that can be added through HTML
    By designextjs in forum Ext 1.x: User Extensions and Plugins
    Replies: 0
    Last Post: 26 Jul 2011, 2:17 PM
  4. 'AddEvents' on extended control
    By VATigers in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 23 Mar 2009, 8:04 AM
  5. TabIndex on extended control
    By VATigers in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 20 Mar 2009, 5:40 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
  •