View Full Version : typeerror: w.constrain is not a function

3 Aug 2010, 6:34 AM
I've just started to experiment with Sencha touch and am proceeding through a tutorial that I found here:


I set up an html page that has the following element:

<div id="test"></div>

and run the following code in firebug:

Ext.get(document.body).update('<div id="test"></div>');
new Ext.Panel({
renderTo: 'test',
width: '200px',
title: 'My Title',
html: 'My HTML content',
collapsible: true

The code works somewhat in that the text "My HTML content" shows up in the div, but the formatting does not match the example nor is there any collapsibility. In addition, the following error is generated:

TypeError: w.constrain is not a function

I have deviated from the example in order to try to get it to work. Basically I have simplified down to the following:

1. HTML page index.html has the "test" div in the body instead of using js to place it there
2. The only resources referenced are:
- ext-touch-debug.js
- ext-touch.css

Such a simple example and yet I can't get it to work. Anyone have any ideas?


3 Aug 2010, 6:48 AM
The Tutorial you are referring to is designed for (now obsolete) Ext 2.0.

Current releases of Ext/Touch utilize a Number only for designating width and height. Modify your sample to:

width: 200,

4 Aug 2010, 9:20 AM
That corrected the error, thanks! The ui doesn't display as in the tutorial, but as you said it is probably because of the difference between versions. I have started to experiment with the classes that I see in the ext-touch.css file to check out the behavior.