Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

display hundreds of rows with tableviewrow

$
0
0

using these lines of code I can display aproximately hundreds of tableviewrows in a tableview. The problem is that the window is opening in 3 seconds (android device). I guess there's some optimization I have to do in order to display the table in less than 1 sec.

any advice about it? thanks in advance

codes in plain :

module.exports.draw = function(){
            els = [];
            var cocktails = Ti.App.cocktails;
 
            for(var i=0;i<cocktails.length;i++){
                    els.push({
                            type: 'Ti.UI.View',
                            searchableText : cocktails[i].nome,
                            properties : {
                                cocktail_id:cocktails[i].id,
                                borderColor:"#eee",
                                borderWidth: 1,
                            height: 100,
                            nome:cocktails[i].nome
                            },
                            childTemplates : [
                                    {
                                            type: 'Ti.UI.Label',
                                            bindId : cocktails[i].id,
                                            properties : {
                                               text: cocktails[i].nome,
                                               cocktail_id:cocktails[i].id,
                                               color:"#000",
                                               left:30,
                                               zIndex:10,
                                               top:10,
                                               font:{
                                                    fontSize:20,
                                                    fontWeight:'bold'
                                               }                   
                                            },
                                            events : {
                                                    click : function(e) {
                                                            Ti.App.fireEvent("render",{pag:'prepare',id:e.bindId});
                                                    }
                                            }
                                    },
                                    {
                                            type : 'Ti.UI.Label',
                                            properties : {
                                                    left:30,
                                                    color:"#999",
                                                    top:50,
                                                    cocktail_id:cocktails[i].id,
                                                    text:cocktails[i].ingTxt != undefined?cocktails[i].ingTxt:''   
                                            },
                                            bindId:cocktails[i].id,
                                            events : {
                                                    click : function (e){
                                                            Ti.App.fireEvent("render",{pag:'prepare',id:e.bindId});
                                                    }
                                            }
                                    }
                            ]
                    });
            }
        var search = Ti.UI.createSearchBar({
                    height:50,
                    width:'100%'
            });
            search.addEventListener('cancel', function(){
                search.blur();
            });
            var content = Ti.UI.createListView({sections:[Ti.UI.createListSection({items: els})],searchView:search});
            search.addEventListener('change', function(e){
            content.searchText = e.value;
        });
            return content;
    };
thanks in advance Dario

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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