Threaded View

  1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    45
    Answers
    7
    Vote Rating
    1
    Malro is on a distinguished road

      0  

    Default Answered: List/Formpanel (Master/Detail ) after production build the form is empty

    Answered: List/Formpanel (Master/Detail ) after production build the form is empty


    Hello,

    i coded a master-detail-view. The master is a list. By itemTap the form is created and should show the current record of the list. All works fine for me, but after "sencha app build production" the form is empty.

    To reproduce i coded a (very) small example of the behavior. I started with generating a new clean project.
    Than i implemented a short list.

    Code:
    Ext.define('Test.view.MyList', {
        extend: 'Ext.dataview.List',
        xtype: 'MyList',
        requires: [
        'Ext.data.Store'
        ],
        config: {
            fullscreen: true,
            itemTpl: '{title} {text}',
            data: [
            {
                title: 'Item 1', 
                text: 'text 1'
            },
            {
                title: 'Item 2', 
                text: 'text 2'
            }
            ],
            listeners: {
                itemtap: function( list, index, target, record, e, eOpts ) {
                    var form = {
                        xtype: 'MyForm', 
                        initialize: function () {
                            this.callParent(arguments);                     
                            // in real app i want to format the output, thats why i am using setValue()
                            Ext.Array.each(this.getItems().items, function(item) {
                                var name = item.getName();
                                var value = record.get(name);
                                item.setValue(value);
                            });
                        }
                    };
                    Ext.Viewport.setActiveItem(form);
                }
            }
        }
    });
    MyForm.js:
    Code:
    Ext.define('Test.view.MyForm', {
        extend: 'Ext.form.Panel',
        xtype: 'MyForm',
        requires: [
            'Ext.field.Text'
        ],
        config: {
            fullscreen: true,
            defaults: {
                xtype: 'textfield'
            },
            items: [
            {
                name: 'title',
                label: 'Title'
            },
            {
                name: 'text',
                label: 'Text'
            }
            ]
        }
    });
    the result is (first the list, second after itemTap):
    before.png

    after running the "sencha app build production"-command the result is:
    after.png

    Whats wrong? why form is empty? (Testing has the same result, empty form, no error, no warning)

    Sencha Touch 2.1.0
    Sencha Cmd 3.0.0.250

  2. In production, you cannot override methods (initialize) like that.

Thread Participants: 1