1. #1
    Sencha User
    Join Date
    Apr 2010
    Location
    Houston, TX, USA
    Posts
    25
    Vote Rating
    2
    keithhackworth is on a distinguished road

      0  

    Default Answered: Ext.form.Panel.removeChildEls is not a function

    Answered: Ext.form.Panel.removeChildEls is not a function


    Using 4.0.2a:
    I'm trying to write a function to selectively remove elements from a form panel and the removeChildEls function does not exist on my Ext.form.Panel object. I can write an 'each' statement to do it, I guess, but seems like we either need to remove the removeChildEls from the documentation, or correct the object. Here's an example. When the user changes the dropdown, I want to clear all the fields from the form panel, except the dropdown:

    Code:
                this.recurrenceForm= Ext.create('Ext.form.Panel', {
                    title: 'Recurring Item',
                    id: 'recurringform',
                    items: [
                        {
                            xtype: 'button',
                            text: 'this should be removed!'
                        },
                        {
                            xtype: 'combobox',
                            id: 'frequency',
                            queryMode: 'local',
                            lastQuery: '',
                            store: Ext.create('Ext.data.Store', {
                                fields: [ 'frequency' ],
                                data: [ { frequency: 'Daily' }, { frequency: 'Weekly' }, { frequency: 'Monthly' } ]
                            }),
                            valueField: 'frequency',
                            displayField: 'frequency',
                            value: 'Daily',
                            listeners: {
                                select: {
                                    fn: function(field, value) {
                                        alert(this.recurrenceForm.id);  // this returns 'recurringform'
                                        alert(this.recurrenceForm.removeChildEls);  // this returns null!
                                        this.recurrenceForm.removeChildEls(function(o) { return ( o.id == 'frequency' ) ? false : true; });   // this should remove the button above this
                                    },
                                    scope: this
                                }
                            }
                        }
                    ]
                });
    Thanks,
    Keith

  2. It seems that this method is missing from 4.0.2 but it is there in 4.0.5.

    However, it doesn't really matter because it won't do what you want anyway. It is for removing elements from childEls, not child components:

    http://docs.sencha.com/ext-js/4-0/#!...t-cfg-childEls

    You'll need to use the remove() method instead.

    One other thing:

    Code:
    function(o) { return ( o.id == 'frequency' ) ? false : true; }
    can be simplified to:

    Code:
    function(o) { return o.id != 'frequency'; }

  3. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,605
    Answers
    543
    Vote Rating
    326
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    It seems that this method is missing from 4.0.2 but it is there in 4.0.5.

    However, it doesn't really matter because it won't do what you want anyway. It is for removing elements from childEls, not child components:

    http://docs.sencha.com/ext-js/4-0/#!...t-cfg-childEls

    You'll need to use the remove() method instead.

    One other thing:

    Code:
    function(o) { return ( o.id == 'frequency' ) ? false : true; }
    can be simplified to:

    Code:
    function(o) { return o.id != 'frequency'; }

Thread Participants: 1

Tags for this Thread