Titanium Community Questions & Answer Archive

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

Update specific child to tableView row from a child window?

Update specific child to tableView row from a child window?

I'm trying to update a imageView child to my tableView row from a child window.

I've done this so far

news.js (my first window)

win2.addEventListener("updateBookmarkIcon",function(data){
 var rowCdata = tableView.getIndexByName(''+data.rowname+''); 
alert(rowCdata);
});

And then in viewnews.js (child window to news.js)

var newdata = {title:title, rowname:''+rowname+''}; 
win.fireEvent("updateBookmarkIcon",newdata);

This works great I'm getting the rowname as expected.

But I want to hide()/show() a imageView inside my tableView row which is created like this in news.js

var row = Titanium.UI.createTableViewRow({
                                        height:74,
                                        backgroundImage:'images/viewbg1.png',
                                        selectedBackgroundImage:'images/viewbg2.png',
                                        rightImage:'images/arrow.png',
                                        selectionStyle:Titanium.UI.iPhone.TableViewCellSelectionStyle.GRAY,
                                        backgroundLeftCap:10,
                                        backgroundTopCap:10
                                    });
var bookmark_icon = Titanium.UI.createImageView({
backgroundImage:'images/favorit.png',
top:0, right:-22, height:20, width:20 }); 


bookmark_icon is then added to my "row" like this:

row.add(bookmark_icon);

Is it possible to update a child with this approach? I don't want to rebuild my entire row just to hide/show a child image inside the row.

— asked November 29th 2010 by Ted Sundin
0 Comments

1 Answer

  • Ted

    Are you asking how to show or hide an image? if so, there are show() and hide() methods of the Titanium.UI.ImageView-object. If you need more than this, would you paste the whole script (or a stripped down version of it)?

    — answered November 29th 2010 by Paul Dowsett
    permalink
    1 Comment
    • No I know how to hide/show an imageView.

      But I would like to do that from a child window. My main problem is that the imageView is a child within a tableViewRow.

      Here is some more code:

      news.js
      http://www.pastie.org/1332228

      viewnews.js //Child window
      http://www.pastie.org/1332232

      I'm creating an eventlistener in the tableViews click eventlistener. Everything works great so far, but how can I update my specific row within the eventlistener "updateBookmarkIcon" I have the rowname which needs to be updated.

      — commented November 29th 2010 by Ted Sundin
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.