Results 1 to 3 of 3

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

  1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    49
    Answers
    7
    Vote Rating
    8
      0  

    Default 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.

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3932
    Vote Rating
    1272
      0  

    Default

    In production, you cannot override methods (initialize) like that.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    49
    Answers
    7
    Vote Rating
    8
      0  

    Default

    mh okay. i am now using still the record config of the list. sencha is doing the "magic". what is the easiest way to transform the output? e.g. record contains some date fields. In detailview i want only show day, time or whatever. is there something like a renderer? For now, i just transform the data on serverside and add fields to store/model.

Posting Permissions

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