extjs6 popup window, error on second time I launch window










0















In my extjs6 project I have a contextmenu button that I launch a modal popup window with a grid inside. I tried to create it so it only creates the component once, and that window isn't created everytime I click the contextmenu item but I am doing something wrong.



It works the first time, but when I click it the second time I get an error
CANNOT READ PROPERTY 'viewModel' of null.



Can someone see what I am doing wrong?



the error appears when I get to this.tempWindow.show()



VIEW, window is popup window, grid is where the itemcontext menu is located



Ext.define('Window2', 
extend: 'Ext.window.Window',
xtype: 'window2',
title: 'Market Breakdown',
width: 600,
height: 600,
modal: true,
controller: 'portalRealtime-portalRealtime',
viewModel:
type: 'portalRealtimeVM'
,
items: [
xtype: 'grid',
title: 'hello',
width: 200,
height: 200
]
);

xtype: 'grid',
title: 'Details',
itemId: 'detailsGridID',
bind:
store: 'myDetailsStore'
,
flex: 3,
margin: '5px 0px 0px 0px',
ui: 'featuredpanel-framed',
cls: 'custom-grid',
height: '100%',
collapsible: true,
collapseDirection: 'left',
listeners:
itemcontextmenu: 'showContextMenuDetails'
,


CONTROLLER



 showContextMenuDetails: function (view, rec, node, index, e) 
e.stopEvent();
this.getContextMenuDetails(rec).show().setPagePosition(e.getXY());
return false;
,

getContextMenuDetails: function (rec)
if (!this.contextMenu)
this.contextMenu = this.getView().add(
xtype: 'contextMenuMarketDrilldownAccount',
currentRecord: rec
);

return this.contextMenu;
,

onContextButtonMarketDrilldown: function (item, e)

var menu = item.up('menu');
var rec = menu.currentRecord;
var bbSymbol = rec.get('BBSymbol');

debugger;
if (!this.tempWindow)
this.tempWindow = this.getView().add(
xtype: 'window2',
);

this.tempWindow.show();
,









share|improve this question




























    0















    In my extjs6 project I have a contextmenu button that I launch a modal popup window with a grid inside. I tried to create it so it only creates the component once, and that window isn't created everytime I click the contextmenu item but I am doing something wrong.



    It works the first time, but when I click it the second time I get an error
    CANNOT READ PROPERTY 'viewModel' of null.



    Can someone see what I am doing wrong?



    the error appears when I get to this.tempWindow.show()



    VIEW, window is popup window, grid is where the itemcontext menu is located



    Ext.define('Window2', 
    extend: 'Ext.window.Window',
    xtype: 'window2',
    title: 'Market Breakdown',
    width: 600,
    height: 600,
    modal: true,
    controller: 'portalRealtime-portalRealtime',
    viewModel:
    type: 'portalRealtimeVM'
    ,
    items: [
    xtype: 'grid',
    title: 'hello',
    width: 200,
    height: 200
    ]
    );

    xtype: 'grid',
    title: 'Details',
    itemId: 'detailsGridID',
    bind:
    store: 'myDetailsStore'
    ,
    flex: 3,
    margin: '5px 0px 0px 0px',
    ui: 'featuredpanel-framed',
    cls: 'custom-grid',
    height: '100%',
    collapsible: true,
    collapseDirection: 'left',
    listeners:
    itemcontextmenu: 'showContextMenuDetails'
    ,


    CONTROLLER



     showContextMenuDetails: function (view, rec, node, index, e) 
    e.stopEvent();
    this.getContextMenuDetails(rec).show().setPagePosition(e.getXY());
    return false;
    ,

    getContextMenuDetails: function (rec)
    if (!this.contextMenu)
    this.contextMenu = this.getView().add(
    xtype: 'contextMenuMarketDrilldownAccount',
    currentRecord: rec
    );

    return this.contextMenu;
    ,

    onContextButtonMarketDrilldown: function (item, e)

    var menu = item.up('menu');
    var rec = menu.currentRecord;
    var bbSymbol = rec.get('BBSymbol');

    debugger;
    if (!this.tempWindow)
    this.tempWindow = this.getView().add(
    xtype: 'window2',
    );

    this.tempWindow.show();
    ,









    share|improve this question


























      0












      0








      0








      In my extjs6 project I have a contextmenu button that I launch a modal popup window with a grid inside. I tried to create it so it only creates the component once, and that window isn't created everytime I click the contextmenu item but I am doing something wrong.



      It works the first time, but when I click it the second time I get an error
      CANNOT READ PROPERTY 'viewModel' of null.



      Can someone see what I am doing wrong?



      the error appears when I get to this.tempWindow.show()



      VIEW, window is popup window, grid is where the itemcontext menu is located



      Ext.define('Window2', 
      extend: 'Ext.window.Window',
      xtype: 'window2',
      title: 'Market Breakdown',
      width: 600,
      height: 600,
      modal: true,
      controller: 'portalRealtime-portalRealtime',
      viewModel:
      type: 'portalRealtimeVM'
      ,
      items: [
      xtype: 'grid',
      title: 'hello',
      width: 200,
      height: 200
      ]
      );

      xtype: 'grid',
      title: 'Details',
      itemId: 'detailsGridID',
      bind:
      store: 'myDetailsStore'
      ,
      flex: 3,
      margin: '5px 0px 0px 0px',
      ui: 'featuredpanel-framed',
      cls: 'custom-grid',
      height: '100%',
      collapsible: true,
      collapseDirection: 'left',
      listeners:
      itemcontextmenu: 'showContextMenuDetails'
      ,


      CONTROLLER



       showContextMenuDetails: function (view, rec, node, index, e) 
      e.stopEvent();
      this.getContextMenuDetails(rec).show().setPagePosition(e.getXY());
      return false;
      ,

      getContextMenuDetails: function (rec)
      if (!this.contextMenu)
      this.contextMenu = this.getView().add(
      xtype: 'contextMenuMarketDrilldownAccount',
      currentRecord: rec
      );

      return this.contextMenu;
      ,

      onContextButtonMarketDrilldown: function (item, e)

      var menu = item.up('menu');
      var rec = menu.currentRecord;
      var bbSymbol = rec.get('BBSymbol');

      debugger;
      if (!this.tempWindow)
      this.tempWindow = this.getView().add(
      xtype: 'window2',
      );

      this.tempWindow.show();
      ,









      share|improve this question
















      In my extjs6 project I have a contextmenu button that I launch a modal popup window with a grid inside. I tried to create it so it only creates the component once, and that window isn't created everytime I click the contextmenu item but I am doing something wrong.



      It works the first time, but when I click it the second time I get an error
      CANNOT READ PROPERTY 'viewModel' of null.



      Can someone see what I am doing wrong?



      the error appears when I get to this.tempWindow.show()



      VIEW, window is popup window, grid is where the itemcontext menu is located



      Ext.define('Window2', 
      extend: 'Ext.window.Window',
      xtype: 'window2',
      title: 'Market Breakdown',
      width: 600,
      height: 600,
      modal: true,
      controller: 'portalRealtime-portalRealtime',
      viewModel:
      type: 'portalRealtimeVM'
      ,
      items: [
      xtype: 'grid',
      title: 'hello',
      width: 200,
      height: 200
      ]
      );

      xtype: 'grid',
      title: 'Details',
      itemId: 'detailsGridID',
      bind:
      store: 'myDetailsStore'
      ,
      flex: 3,
      margin: '5px 0px 0px 0px',
      ui: 'featuredpanel-framed',
      cls: 'custom-grid',
      height: '100%',
      collapsible: true,
      collapseDirection: 'left',
      listeners:
      itemcontextmenu: 'showContextMenuDetails'
      ,


      CONTROLLER



       showContextMenuDetails: function (view, rec, node, index, e) 
      e.stopEvent();
      this.getContextMenuDetails(rec).show().setPagePosition(e.getXY());
      return false;
      ,

      getContextMenuDetails: function (rec)
      if (!this.contextMenu)
      this.contextMenu = this.getView().add(
      xtype: 'contextMenuMarketDrilldownAccount',
      currentRecord: rec
      );

      return this.contextMenu;
      ,

      onContextButtonMarketDrilldown: function (item, e)

      var menu = item.up('menu');
      var rec = menu.currentRecord;
      var bbSymbol = rec.get('BBSymbol');

      debugger;
      if (!this.tempWindow)
      this.tempWindow = this.getView().add(
      xtype: 'window2',
      );

      this.tempWindow.show();
      ,






      extjs popupwindow






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 '18 at 17:26







      solarissf

















      asked Nov 14 '18 at 16:50









      solarissfsolarissf

      451623




      451623






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Try put viewModel and controler atributes properly configured with your controller and viewModel.



          Ext.define('Window2', 
          extend: 'Ext.window.Window',
          xtype: 'window2',
          title: 'Market Breakdown',
          width: 600,
          height: 600,
          modal: true,
          viewModel:
          type: 'Window2' //Yout window viewModel
          ,
          controller: 'Window2', //Your window controller,
          items: [
          xtype: 'grid',
          title: 'hello',
          width: 200,
          height: 200
          ]
          );





          share|improve this answer























          • I added controller, but I don't have a viewModel. I have the file for the view, and a file for the controller. is that my issue?

            – solarissf
            Nov 14 '18 at 17:03











          • You need use the same viewModel and the same controller, from your call location on trigger window to show. All action must be in same context (viewmode/controller)

            – Daniel da Cunha Bueno
            Nov 14 '18 at 17:07











          • I'm not sure I'm understanding it correctly... I added the same viewmodel to the window, and the same viewmodel as the view the grid is in. now I get error CANNOT REAL PROPERTY OF SESSION OF NULL

            – solarissf
            Nov 14 '18 at 17:27











          • I think I got it... I added the following to the window... does that seem right to you? closable: true, closeAction: 'hide',

            – solarissf
            Nov 14 '18 at 17:40












          • Ok, understood! closeAction hide will keep viewModel always active and accessible! Try it.

            – Daniel da Cunha Bueno
            Nov 15 '18 at 12:01










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305141%2fextjs6-popup-window-error-on-second-time-i-launch-window%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Try put viewModel and controler atributes properly configured with your controller and viewModel.



          Ext.define('Window2', 
          extend: 'Ext.window.Window',
          xtype: 'window2',
          title: 'Market Breakdown',
          width: 600,
          height: 600,
          modal: true,
          viewModel:
          type: 'Window2' //Yout window viewModel
          ,
          controller: 'Window2', //Your window controller,
          items: [
          xtype: 'grid',
          title: 'hello',
          width: 200,
          height: 200
          ]
          );





          share|improve this answer























          • I added controller, but I don't have a viewModel. I have the file for the view, and a file for the controller. is that my issue?

            – solarissf
            Nov 14 '18 at 17:03











          • You need use the same viewModel and the same controller, from your call location on trigger window to show. All action must be in same context (viewmode/controller)

            – Daniel da Cunha Bueno
            Nov 14 '18 at 17:07











          • I'm not sure I'm understanding it correctly... I added the same viewmodel to the window, and the same viewmodel as the view the grid is in. now I get error CANNOT REAL PROPERTY OF SESSION OF NULL

            – solarissf
            Nov 14 '18 at 17:27











          • I think I got it... I added the following to the window... does that seem right to you? closable: true, closeAction: 'hide',

            – solarissf
            Nov 14 '18 at 17:40












          • Ok, understood! closeAction hide will keep viewModel always active and accessible! Try it.

            – Daniel da Cunha Bueno
            Nov 15 '18 at 12:01















          1














          Try put viewModel and controler atributes properly configured with your controller and viewModel.



          Ext.define('Window2', 
          extend: 'Ext.window.Window',
          xtype: 'window2',
          title: 'Market Breakdown',
          width: 600,
          height: 600,
          modal: true,
          viewModel:
          type: 'Window2' //Yout window viewModel
          ,
          controller: 'Window2', //Your window controller,
          items: [
          xtype: 'grid',
          title: 'hello',
          width: 200,
          height: 200
          ]
          );





          share|improve this answer























          • I added controller, but I don't have a viewModel. I have the file for the view, and a file for the controller. is that my issue?

            – solarissf
            Nov 14 '18 at 17:03











          • You need use the same viewModel and the same controller, from your call location on trigger window to show. All action must be in same context (viewmode/controller)

            – Daniel da Cunha Bueno
            Nov 14 '18 at 17:07











          • I'm not sure I'm understanding it correctly... I added the same viewmodel to the window, and the same viewmodel as the view the grid is in. now I get error CANNOT REAL PROPERTY OF SESSION OF NULL

            – solarissf
            Nov 14 '18 at 17:27











          • I think I got it... I added the following to the window... does that seem right to you? closable: true, closeAction: 'hide',

            – solarissf
            Nov 14 '18 at 17:40












          • Ok, understood! closeAction hide will keep viewModel always active and accessible! Try it.

            – Daniel da Cunha Bueno
            Nov 15 '18 at 12:01













          1












          1








          1







          Try put viewModel and controler atributes properly configured with your controller and viewModel.



          Ext.define('Window2', 
          extend: 'Ext.window.Window',
          xtype: 'window2',
          title: 'Market Breakdown',
          width: 600,
          height: 600,
          modal: true,
          viewModel:
          type: 'Window2' //Yout window viewModel
          ,
          controller: 'Window2', //Your window controller,
          items: [
          xtype: 'grid',
          title: 'hello',
          width: 200,
          height: 200
          ]
          );





          share|improve this answer













          Try put viewModel and controler atributes properly configured with your controller and viewModel.



          Ext.define('Window2', 
          extend: 'Ext.window.Window',
          xtype: 'window2',
          title: 'Market Breakdown',
          width: 600,
          height: 600,
          modal: true,
          viewModel:
          type: 'Window2' //Yout window viewModel
          ,
          controller: 'Window2', //Your window controller,
          items: [
          xtype: 'grid',
          title: 'hello',
          width: 200,
          height: 200
          ]
          );






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 '18 at 16:58









          Daniel da Cunha BuenoDaniel da Cunha Bueno

          1416




          1416












          • I added controller, but I don't have a viewModel. I have the file for the view, and a file for the controller. is that my issue?

            – solarissf
            Nov 14 '18 at 17:03











          • You need use the same viewModel and the same controller, from your call location on trigger window to show. All action must be in same context (viewmode/controller)

            – Daniel da Cunha Bueno
            Nov 14 '18 at 17:07











          • I'm not sure I'm understanding it correctly... I added the same viewmodel to the window, and the same viewmodel as the view the grid is in. now I get error CANNOT REAL PROPERTY OF SESSION OF NULL

            – solarissf
            Nov 14 '18 at 17:27











          • I think I got it... I added the following to the window... does that seem right to you? closable: true, closeAction: 'hide',

            – solarissf
            Nov 14 '18 at 17:40












          • Ok, understood! closeAction hide will keep viewModel always active and accessible! Try it.

            – Daniel da Cunha Bueno
            Nov 15 '18 at 12:01

















          • I added controller, but I don't have a viewModel. I have the file for the view, and a file for the controller. is that my issue?

            – solarissf
            Nov 14 '18 at 17:03











          • You need use the same viewModel and the same controller, from your call location on trigger window to show. All action must be in same context (viewmode/controller)

            – Daniel da Cunha Bueno
            Nov 14 '18 at 17:07











          • I'm not sure I'm understanding it correctly... I added the same viewmodel to the window, and the same viewmodel as the view the grid is in. now I get error CANNOT REAL PROPERTY OF SESSION OF NULL

            – solarissf
            Nov 14 '18 at 17:27











          • I think I got it... I added the following to the window... does that seem right to you? closable: true, closeAction: 'hide',

            – solarissf
            Nov 14 '18 at 17:40












          • Ok, understood! closeAction hide will keep viewModel always active and accessible! Try it.

            – Daniel da Cunha Bueno
            Nov 15 '18 at 12:01
















          I added controller, but I don't have a viewModel. I have the file for the view, and a file for the controller. is that my issue?

          – solarissf
          Nov 14 '18 at 17:03





          I added controller, but I don't have a viewModel. I have the file for the view, and a file for the controller. is that my issue?

          – solarissf
          Nov 14 '18 at 17:03













          You need use the same viewModel and the same controller, from your call location on trigger window to show. All action must be in same context (viewmode/controller)

          – Daniel da Cunha Bueno
          Nov 14 '18 at 17:07





          You need use the same viewModel and the same controller, from your call location on trigger window to show. All action must be in same context (viewmode/controller)

          – Daniel da Cunha Bueno
          Nov 14 '18 at 17:07













          I'm not sure I'm understanding it correctly... I added the same viewmodel to the window, and the same viewmodel as the view the grid is in. now I get error CANNOT REAL PROPERTY OF SESSION OF NULL

          – solarissf
          Nov 14 '18 at 17:27





          I'm not sure I'm understanding it correctly... I added the same viewmodel to the window, and the same viewmodel as the view the grid is in. now I get error CANNOT REAL PROPERTY OF SESSION OF NULL

          – solarissf
          Nov 14 '18 at 17:27













          I think I got it... I added the following to the window... does that seem right to you? closable: true, closeAction: 'hide',

          – solarissf
          Nov 14 '18 at 17:40






          I think I got it... I added the following to the window... does that seem right to you? closable: true, closeAction: 'hide',

          – solarissf
          Nov 14 '18 at 17:40














          Ok, understood! closeAction hide will keep viewModel always active and accessible! Try it.

          – Daniel da Cunha Bueno
          Nov 15 '18 at 12:01





          Ok, understood! closeAction hide will keep viewModel always active and accessible! Try it.

          – Daniel da Cunha Bueno
          Nov 15 '18 at 12:01



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305141%2fextjs6-popup-window-error-on-second-time-i-launch-window%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Medaillenspiegel der Olympischen Winterspiele 1968

          Kleinkühnau

          Makov (Slowakei)