Results 1 to 2 of 2

Thread: Safe to open a modal window and passing current view model as parent?

  1. #1
    Sencha User
    Join Date
    Dec 2007
    Posts
    11
    Answers
    1

    Default Safe to open a modal window and passing current view model as parent?

    Hi all,

    obviously the following code seems to work correctly:
    Code:
    var win = Ext.widget('PromptAnswerWin', {
                            viewModel: {
                                type: 'PromptAnswerVM',
                                data: data,
                                parent : this.getViewModel()
                            },
                            items: [{
                                xtype: ('ATTRIBUTE' === _type) ? 'AttributePrompt' : 'MetricPrompt'
                            }]
                        }).show();
    The docs are saying, that "once set, this cannot be changed". Am I allowed to do this (setting the parent of the view model to the calling instance or am I breaking some kind of internal processing logic?
    The only other way of passing the current view model as the parent in the modal windows component hierarchy is to include the modal window as a floating item in the items section of the container holding the viewModel and the viewController, then looking it up via
    Code:
    this.lookupReference('myModalWindow')
    and showing it.

    Both ways work, is the first way ok ?
    Olli

  2. #2
    Sencha - Sustaining Engineer tristan.lee's Avatar
    Join Date
    Mar 2015
    Location
    Central Ohio
    Posts
    1,579
    Answers
    165

    Default

    You may want to check this out if you already haven't (perhaps it is what you were referring to about including it as a floating component): https://www.sencha.com/forum/showthr...g-popup-window

    I am not sure if either are officially supported though. In your method when you add it as a parent, I wonder if this would cause issues on multiple instances of a window to the same VM.
    Tristan Lee
    Sencha Inc - Sustaining Engineer


    Having an issue? Help us help you - be detailed; provide some code; demonstrate with a fiddle (fiddle.sencha.com)

    Embed your fiddle in your post: [FIDDLE]id[/FIDDLE]

Similar Threads

  1. Replies: 0
    Last Post: 5 Aug 2015, 11:33 AM
  2. Replies: 1
    Last Post: 26 Nov 2014, 4:04 PM
  3. Passing parameters to modal window and back
    By kvajj in forum Ext: Discussion
    Replies: 1
    Last Post: 7 Aug 2012, 2:46 PM
  4. Modal window mask width problem - shows Hz scrollbar in parent window
    By satishp in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 27 May 2009, 11:46 PM
  5. [Workaround] Modal Window constrained to Parent Window?
    By JustinWalsh in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 5 Oct 2007, 9:59 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
  •