Results 1 to 4 of 4

Thread: Design View and Viewmode Links: Invalid Model name

  1. #1
    Sencha Premium User EricRicher's Avatar
    Join Date
    Jul 2014
    Posts
    45
    Vote Rating
    2
      1  

    Default Design View and Viewmode Links: Invalid Model name

    I define a model, view and a viewModel as follow using Architect:

    Code:
    Ext.define('MyApp.view.FormPanel', {
        extend: 'Ext.form.Panel',
        alias: 'widget.formpanel',
    
    
        requires: [
            'MyApp.view.FormPanelViewModel'
        ],
    
    
        viewModel: {
            type: 'formpanel'
        },
        title: 'My Form'
    
    
    });
    
    Ext.define('MyApp.view.FormPanelViewModel', {
        extend: 'Ext.app.ViewModel',
        alias: 'viewmodel.formpanel',
    
    
        links: {
            theUser: {
                type: 'User',
                create: true
            }
        }
    
    
    });
    
    Ext.define('MyApp.model.User', {
        extend: 'Ext.data.Model',
        alias: 'model.user',
    
        requires: [
            'Ext.data.field.Field'
        ],
    
    
    
    
        fields: [
            {
                name: 'firstname'
            },
            {
                name: 'lastname'
            }
        ]
    
    
    });
    Every time I go to Design View to look at the form, I get the following error in the log:

    Capture.jpg

    I tried setting type to 'MyApp.model.User' , 'model.User' or simply 'user' in the links config and I get the same error.

    Any ideas what I am doing wrong or is this a bug?

  2. #2
    Sencha Premium User EricRicher's Avatar
    Join Date
    Jul 2014
    Posts
    45
    Vote Rating
    2
      0  

    Default

    Not gathering a lot of replies to my question...

    Was hoping someone from Sencha would pick it up to see if this is an issue, so I will post it in the bugs forum.

    But to add to this, Architect cannot render a view that has Links in the ViewModel. This is annoying to me right now as I am using links in many forms and views to download/upload server data. None of them are showing up in the Design view which sorts of defeats the purpose of using Architect as a visual desing tool.

    However, even if Architect has a issue dealing with links config in viewmodels, the code works perfectly fine and as expected.

    Here's an archive of a small test project to show this problem. The project is using the modern toolkit.

    https://www.dropbox.com/s/fv8vyt5e10...sTest.xda?dl=0

    (Could not figure out how to upload a xda file on the forum although it is supposed to be allowed...)

  3. #3
    Sencha Premium Member
    Join Date
    Jan 2010
    Location
    Vancouver, Canada
    Posts
    231
    Answers
    2
    Vote Rating
    71
      0  

    Default

    I just want to confirm that I see the same error. I specified the full name of the model, and it doesn't make any difference. The form is not rendered anymore in SA which is very annoying.

    Another way to do it is to simply add the record (theUser) to the data property (data: {theUser: null}) and create the User model in the override for the ViewModel - you'd have to select the ViewModel and click the CreateOverride button:

    Code:
    constructor: function() {
          var me = this;      
          me.callParent(arguments);
          me.data.theUser = Ext.create('MyApp.model.User');
    //     debugger;
      },

  4. #4
    Sencha User
    Join Date
    May 2013
    Posts
    1
    Vote Rating
    0
      0  

    Default

    My solution:
    1. Add function initComponent (component template method)
    2. Create link from code

    this.callParent(arguments);


    var user = {
    type: 'MyApp.model.User',
    create: {
    firstName: 'John',
    lastName: 'Smith'
    }};


    var vm = this.getViewModel();
    vm.linkTo('newUser', user);

Similar Threads

  1. Replies: 0
    Last Post: 31 Jul 2017, 1:15 PM
  2. [INFOREQ] Binding to view model links is called multiple times.
    By HriBB in forum Ext 5: Bugs
    Replies: 1
    Last Post: 27 Mar 2015, 7:57 AM
  3. Replies: 3
    Last Post: 24 Sep 2014, 11:18 AM
  4. Initial View, Gridpanel aren't dislayed in Design view
    By msinn in forum Sencha Architect 2.x: Bugs
    Replies: 2
    Last Post: 23 Jun 2012, 7:23 PM

Tags for this Thread

Posting Permissions

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