Quantcast
Viewing all articles
Browse latest Browse all 8068

Getting user's specifc info from for loop(table view)

Hi, I have a tableview with list of users and when i click this button(on each row), i want it to take it to the that user's specific profile page.

I have set it up but which ever user's button i clikc, it takes me to the first user's profile page. for example, if i have row of user1, user2, user3, user4, and each has profile photos, post's content and a button.

If i clikc a button on user 3, it should take me to the user3's profile page but it takes me to user's 1's profile page.

Any help??

//cloud.posts.query function opens 
 
    var tbl_data = []; 
            for (var i = 0; i < e.posts.length; i++) {
                var post = e.posts[i];
 
               //code
 
                var shopping = Ti.UI.createView({
                    backgroundImage: 'shopping.png',
                    width: 35,
                    height: 35,
                    top: 70,
                    right: 10
                });
 
                shopping.addEventListener('click', function(){
                    //alert(post);
                    var tradewin,tradeinc;
                        tradeinc = require('trade');
                        tradewin = new tradeinc.trade1(post);
                        tradewin.open();
                });
 
              }
            var table = Titanium.UI.createTableView({
                data:tbl_data
            });
so the 'shopping' is the button, and it is there for each user.

I have passed the 'post' variable to the new page it opens when it is clicked like this..

function trade1(post){  
 
    var Cloud = require('ti.cloud');
    Cloud.debug = true;
 
    // then i user the 'post' variable here like post.user.first_name etc
    // but its always about the user1 not user 3
 
---function closes

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>