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

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,212
    Answers
    3517
    Vote Rating
    858
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    In production, you cannot override methods (initialize) like that.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

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

      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.

Thread Participants: 1