Titanium Community Questions & Answer Archive

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

Custom view classes

I'm loading a bunch of items from a database, per item I want to create a view, but it should be a view of it's own, it need to contain data specific for that view.

Is it possible to create a custom view class?
Or do I need to find another way around this?

— asked October 31st 2010 by Wouter De Loose
  • custom
  • view
1 Comment
  • Yes, but then we come back to my first question, how can i make a file act like a view?

    Something like view.url = 'test.js' ?

    — commented October 31st 2010 by Wouter De Loose

3 Answers

  • I don't know if this is the right solution for my problem, but I fixed it by creating a new Window and setting the model mode to false.

    Like this:

    var listWindow = Ti.UI.createWindow({
    modal: "false",
    navBarHidden: "true",
    touchEnabled: "true",
    url: "list.js",
    height: 100,
    width: 100,
    data: list
    });

    listWindow.open();
    

    All the windows are added to a scrollableView.

    But I have a feeling that the window doesn't use the width and height, because the background of my entire application just changed to the background aplied in the window.

    — answered October 31st 2010 by Wouter De Loose
    permalink
    0 Comments
  • Windows can be very expensive in terms of resources like memory and slow, you should use views instead.

    — answered October 31st 2010 by John McKnight
    permalink
    1 Comment
    • Yes, but then we come back to my first question, how can i make a file act like a view?

      Something like view.url = 'test.js' ?

      — commented October 31st 2010 by Wouter De Loose
  • Why can't you simply update the controls on the view?

    somelabel.value = 'New text from db';
    

    Put just the view layout settings in the js file. Then, update as needed with the code on-page.

    — answered October 31st 2010 by Tim Poulsen
    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.