Titanium Community Questions & Answer Archive

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

Documentation for layout, heights + tableview events.

First off, this appears to be a great product, I've been hacking away with it for a few days now, but a few things have irked me, mainly around the lack of documentation.. I'd love to see an O'Reilly book on it !!

  1. I can't find any documentation about the layout: attribute, specifically, I think I understand how layout:'vertical' works, ie, it's like a non-floating div, as opposed to an absolutely positioned div.. but I'd rather not make guesses when trying to build a real-world app. Looking for the attribute under the View documentation, it's not even listed. So am I using a hack, or is it just undocumented ?

  2. I can't find any documentation how height: auto works, sometimes it does what I think, and expands to fit the remaining space, othertimes not.

  3. There are Events listed for TableView that just don't fire, any of them that I can see.

Sure, I've seen alot of comments about "look at the examples", but that only shows me what happens when I use the same code, it doesn't tell me why certain things happen, and doesn't tell me what alternative things I can do, or give pointers when it goes wrong.

Also, Googling stuff to find solutions I end up finding old solutions using the old version of Titanium, specifically stuff at http://www.codestrong.com

It'd be great to have a big banner saying "1.0 users ignore this it's out of date".. because there have been so many changes to the API and because there's so little documentation people are going to be trying out old unworking code and wasting their time.

— asked March 26th 2010 by David Brown
  • documentation
  • events
  • height
  • layout
2 Comments
  • It would be great to have a resource or some kind of introduction in how the layout in titanium works.

    — commented June 10th 2010 by Janusz Leidgens
  • I second this. By now I'm pulling all my hair out trying to figure out how the layout stuff works by trial and error and it really is a big waste of time. The API docs are hopeless and as the original question states, a lot of other examples out there are out of date.

    — commented August 2nd 2010 by De Wet Steynberg

2 Answers

  • +1 understanding how all of this works is really a nightmare and a great waste of time. And if you think you have understood how this works with Android … try your application with IPhone and be sure the way the application works will be totally different !

    — answered January 13th 2011 by raymond sclison
    permalink
    0 Comments
  • I'm very disapointed with the way how window.open won't fit screen space. I vote for this question and really need answer.

    Edit: I have found my way !!! use this:

    var nextwin = Ti.UI.createWindow({
        modal: true
    })
    

    then newtwin will fit the screen. You can use fullscreen if you want but you will lose the top bar :)

    For tableview event, kitchenSink have a lot of example. The mainly way to have event and datas are this:

    
    var rows = [
        {title: "the title one", myattribute: 'views/myview1.js'},
        {title: "the title two", myattribute: 'views/myview2.js'},
        {title: "the title three", myattribute: 'views/myview3.js'},
    ];
    
    var mainTableView = Titanium.UI.createTableView({
        data: rows,
        top: 10,
        height: 'auto',
        separatorStyle: Ti.UI.iPhone.TableViewSeparatorStyle.NONE
    });
    
    mainTableView.addEventListener('click', function(e){
        if (e.rowData.target)    {
            var nextwin = Titanium.UI.createWindow({
                url:e.rowData.myattribute,
                title:e.rowData.title,
                            modal: true,
                backgroundColor: '#000',
            });
            nextwin.open({animated:true});
        }
    });
    

    rowData taken from event have every information you need. My documentation is KitchenSink. Website is very in late…

    — answered March 26th 2010 by Patrice Ferlet
    permalink
    3 Comments
    • That is not an answer to the question

      — commented June 10th 2010 by Janusz Leidgens
    • Agreed. Once again this is just one example of layout issues. What we really need is a pointing in the right direction to some detailed documentation on expected behavior for various layout properties and such. We need a broader understanding, not just a few examples.

      — commented August 2nd 2010 by De Wet Steynberg
    • I am struggling to determine what is the size of the component after the layout is complete. But I don't know when the layout of component is over. I have a component which I add it to some other component. i call it as working pane. I want to know the size right after it is opened. But so far no luck. Sometimes I get the data and application works fine and sometimes it fails to get the size. I am calculating the size on windows event. Android emulator API 3.0 and Ti-SDK 1.7

      — commented February 19th 2012 by avaya sahu
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.