0

I have developed an app which requires some container to be drawn based of height & width of device so I have used

[Ext.Viewport.getWindowHeight()][1] &     
Ext.Viewport.getWindowWidth() 

at few places in my code and it was working fine until I did sencha app build package. When I tried to open the packaged app I got this error:

Uncaught TypeError: Cannot call method 'getWindowHeight' of undefined       app.js:1 (anonymous function)

Similar issue was raised in Sencha forum in past but it is unanswered: http://www.sencha.com/forum/showthread.php?240494-Call-method-getWindowHeight-of-undefined

As per Sencha docs : Ext.Viewport is a instance created when you use Ext.setup and if you use Ext.onReady, this instance of Ext.Viewport will not be created. But in my app.js I am using Ext.application() not Ext.setup or Ext.onReady,

is that the reason singleton is not created? If yes how can I fix it?

I am using Sencha Cmd Ver 3.0.2.288 & Sencha Touch ver 2.1.1

Tejas
  • 898
  • 2
  • 15
  • 38
ThinkFloyd
  • 4,981
  • 6
  • 36
  • 56

1 Answers1

0

my solution to the problem was using low-level javascript instead of Sencha's framework.

as described here: http://www.howtocreate.co.uk/tutorials/javascript/browserwindow

in my case, using

window.innerHeight

was enough as my users won't be using IE.

Guy Dubrovski
  • 1,542
  • 1
  • 20
  • 25