Tim Mitchell
Tim Mitchell

Reputation: 653

In IE, removing items from an Ext.form.FieldSet causes the FieldSet to expand

I have an ExtJS project in which I have a FieldSet that I need to dynamically remove items from and replace with different items.

When I remove items and then add new items, however, the FieldSet expands slightly each time, so that the entire FieldSet grows and grows and grows.

This only happens in IE - not Firefox or Chrome.

Here is my Fieldset...

var lonFields = new Ext.form.FieldSet({
        ref: '../../setLonFieldSet',
        layout: {
            type: 'table',
            columns: 2
        }
});

Here is where I reference it, remove everything, and then add new stuff...

Ext.getCmp('maintainGeneratorsBatteriesViewport').setLonFieldSet.removeAll();
Ext.getCmp('maintainGeneratorsBatteriesViewport').setLonFieldSet.add(
                {html: "<b>Default Lon:</b>"}   
            );
Ext.getCmp('maintainGeneratorsBatteriesViewport').setLonFieldSet.add(
                {html: "<b>Default Lon:</b>"}   
            );

As I said, in IE this causes the entire FieldSet to grow in height each time.

Any suggestions?

Thanks in advance, Tim

Upvotes: 0

Views: 132

Answers (1)

Sabbir Ahmed
Sabbir Ahmed

Reputation: 11

Try this:

var fieldSet = Ext.getCmp('your fieldset id');
fieldSet.removeAll(fieldSet.items);
fieldSet.doLayout();

After doing this you can add new item !! :)

Upvotes: 1

Related Questions