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

You must Login before you can answer or comment on any questions.

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 2 years ago by Wil C
0 Comments

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 2 years ago by Colton Arabsky
answer 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 1 year ago by Hector Leiva

  • Hey, great, worked for me too. Ahh the weirdness...

    Thanks!

    — commented 1 year ago 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 12 months ago by sergey chernov

  • Show 1 more comment

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.

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 2 years ago by John McKnight
answer 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 2 years ago 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.

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.

Your Answer

Think you can help? Login to answer this question!