Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Titanium.UI.iPhone.TableViewStyle [undefined] is not an object

Hi, I'm seeing a problem with TableViewStyle. I basically have a heavyweight window that I'm tabbing into. Inside the heavyweight window is the file, where I just cut and pasted from the kitchensink's table_view_section_header.js

var win = Titanium.UI.currentWindow

var inputData = [
    {title:'row 1', header:'Header 1'},
    {title:'row 2'},
    {title:'row 3'},
    {title:'row 4', header:'Header 2'},
    {title:'row 5'}
]; 
var tableView = Titanium.UI.createTableView({ 
    data:inputData, 
    style:Titanium.UI.iPhone.TableViewStyle.GROUPED
}); 
win.add(tableView);

However, that gives me the error:
Result of expression 'Titanium.UI.iPhone.TableViewStyle [undefined] is not an object. at settings.js'. I don't think I'm spelling things wrong

And while I've seen previous questions, the solutions offered up don't seem to work. I've tried cleaning and building, etc.

Also, when I remove the style attribute, it compiles, which means that Titanium.UI is at least available.

Anyone run into this before?

— asked October 23rd 2010 by Wil C
  • error
  • iphone
  • mobile
  • tableview
1 Comment
  • +1 for both questions and answers

    — commented February 28th 2013 by Muhammad Wahhab Mirza

5 Answers

  • Try going to your project root folder, then to "build/iphone/" and deleting the entire folder. Then, just simply run it on a device/simulator and it should work.

    Whenever I have gotten that error (Usually when trying to use SystemButtons) I just have to do that and it'll work fine after I do a fresh re-build.

    — answered October 24th 2010 by Colton Arabsky
    permalink
    4 Comments
    • I followed Colton's advice and it worked completely. Fixed my map's button bar and I actually got going somewhere.

      — commented January 5th 2011 by Hector Leiva
    • Hey, great, worked for me too. Ahh the weirdness…

      Thanks!

      — commented January 31st 2011 by Chris Moore
    • Did not helped n my case. SDK 1.6.2, that is very disturbing. had ti use '1' instead. That does not look like a commercial product. I shoud say.

      — commented May 23rd 2011 by sergey chernov
    • I had the same problem with
      Titanium.UI.iPhone.TableViewScrollPosition' [undefined] is not an object.
      Cleaning build/iphone folder helped. Thanks!

      — commented December 5th 2011 by Zhenya Kogan
  • I ended up just hardcoding it to the number "1" for the time being. It's not ideal, esp if appcelerator decides to change things around for no reason.

    var tableView = Titanium.UI.createTableView({ 
        data:inputData, 
        style:1
    });
    

    If you've got a solution, I'd like to hear it.

    — answered October 23rd 2010 by Wil C
    permalink
    0 Comments
  • What version of the SDK are you using? 1.4.1.1? A daily build? What device are you targeting? I tried your code in 1.4.1.1 and the 1.5 daily and it worked for me but I was specifically targeting iPad.

    — answered October 23rd 2010 by John McKnight
    permalink
    1 Comment
    • I'm using 1.4.1.1 I'm targeting the 1G iPhone on 3.1.3 firmware.

      Hrm….I might suspect that a bad line of code somewhere else may have caused it not to load the rest of Ti.UI.iPhone, and it's just not reporting it in the right place.

      However, I just copied the source from kitchensink. The only difference is that it's under a tab, rather than under a tableView. Would that make a difference?

      — commented October 24th 2010 by Wil C
  • I second the recommendation to clean.

    This happened to me when I installed the app on an iPhone with an older version 4.2 of iOS then I was testing with (4.3)

    Cleaning the project fixed this.

    — answered October 18th 2011 by Wolfgang Loske
    permalink
    0 Comments
  • I got the same error when creating a table view. I am using SDK 1.7.5, iPhone simulator. I went to the Project menu, and hit Clean, then selected my project. The next time I ran the app it ran cleanly, so that fixed the problem.

    — answered February 1st 2012 by Greg Burdett
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.