Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Not consistant behavior when clicking tabs on top

  1. #11
    Sencha Premium User
    Join Date
    Sep 2011
    Location
    Tamworth, NSW, Australia
    Posts
    1,353

    Default

    I found the culprit (something which worked just fine yesterday!):

    Code:
    Ext.define('App.view.ClientFormViewModel', {
        extend: 'Ext.app.ViewModel',
        alias: 'viewmodel.clientform',
        links: {
            theClient: {
                type: 'App.model.ClientInfo',
                id: 1
            }
        }
    });
    So either I got away with something yesterday that I should not have and defining a link to a model instance using the new MVVM style should not be done this way, or something else has gone haywire? Removing this link means that the form renders OK in SA. Is there another (supported) way to define a model link against a form?

  2. #12
    Sencha Premium User
    Join Date
    Sep 2011
    Location
    Tamworth, NSW, Australia
    Posts
    1,353

    Default

    OK, I can set the link like this for now:

    Code:
    onFormAfterRender: function(component, eOpts) {
            this.getViewModel().setLinks({
                theClient: {
                    type: 'App.model.ClientInfo',
                    id: 1
                }
            });
        }
    If this isn't a bug then how should I define the link properly? Thanks.

  3. #13
    Sencha User Phil.Strong's Avatar
    Join Date
    Mar 2007
    Location
    Olney, MD
    Posts
    1,953

    Default

    I'm now realizing it's the canvas that's not rendering rather than another editor. Same for you Bruce?
    Phil Strong
    @philstrong

  4. #14
    Sencha User Phil.Strong's Avatar
    Join Date
    Mar 2007
    Location
    Olney, MD
    Posts
    1,953

    Default

    Marc,

    Seems weird to be defining a link at declaration time. Not sure that's supported. Note in the docs they are doing it dynamically by creating a new VM after they've already loaded the user they are referencing. Not doing it as a class def.
    Phil Strong
    @philstrong

  5. #15
    Sencha Premium User
    Join Date
    Sep 2011
    Location
    Tamworth, NSW, Australia
    Posts
    1,353

    Default

    Quote Originally Posted by Phil.Strong View Post
    Marc,

    Seems weird to be defining a link at declaration time. Not sure that's supported. Note in the docs they are doing it dynamically by creating a new VM after they've already loaded the user they are referencing. Not doing it as a class def.
    So, we shouldn't use the ViewModel created in Sencha Architect automatically when adding a formpanel to the project?

    A lot of the sample code bits in the docs are all very contrived and not particularly "real world" so it's no wonder I'm apparently doing it the wrong way. Opening a formpanel linked to a particular model instance from a database - I would have thought - would be a highly popular requirement.

  6. #16
    Sencha Premium User
    Join Date
    Sep 2011
    Location
    Tamworth, NSW, Australia
    Posts
    1,353

    Exclamation

    Is there a fix for this coming soon? It's becoming almost unbearable to use SA 3.1 at the moment, and I've gone with it for a new Ext JS 5 project, so there's no going back to 3.0.4.

  7. #17
    Sencha User Phil.Strong's Avatar
    Join Date
    Mar 2007
    Location
    Olney, MD
    Posts
    1,953

    Default

    Yeah I understand the confusion. I think passing it in as a config as a Ext.Create is the correct way to do this. In other words creating a definition that hard codes 1 is going to fail in the canvas as we don't have access to that model data.
    Phil Strong
    @philstrong

  8. #18
    Sencha Premium User
    Join Date
    Sep 2011
    Location
    Tamworth, NSW, Australia
    Posts
    1,353

    Default

    Quote Originally Posted by Phil.Strong View Post
    Yeah I understand the confusion. I think passing it in as a config as a Ext.Create is the correct way to do this. In other words creating a definition that hard codes 1 is going to fail in the canvas as we don't have access to that model data.
    How should I do it "the right way" with Architect?

Page 2 of 2 FirstFirst 12

Posting Permissions

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