enyo - WebOS VirtualList Problem -


in code tring display sqlite db in vertual list , in code in loop can see commented alerts , conform value want want db.

now value want show in vertual list.

i know solution setup data in array , render how? can please replay edit code

/* copyright 2009-2011 hewlett-packard development company, l.p. rights reserved. */ enyo.kind({    name: "storage.sqlite",    kind: headerview,    components: [       {name: "createdbbutton", kind: "button", caption: "create database", onclick: "createdb"},       {name: "createtablebutton", kind: "button", caption: "create table1", onclick: "createtable"},       {name: "filltablebutton", kind: "button", caption: "insert row table1", onclick: "filltable"},       {name: "querybutton", kind: "button", caption: "show table1 contents", onclick: "doquery"},       {name: "results", kind: "htmlcontent"},       {kind: "virtuallist", name:"myvirtuallist", style: "width: 500px; height: 200px;",       components: [            {kind: "item", layoutkind: "hflexlayout", components: [               {name: "caption1", flex: 1},               {name: "caption2", flex: 1},             ]}          ]       }      ],    createdb: function() {       try {          this.db = opendatabase('sampledb', '', 'sample data store', 65536);          this.$.results.setcontent("created database sampledb.");       }       catch (e)       {          this.$.results.setcontent(e);             }    },    createtable: function() {       try {          this.nullhandlecount = 0;          //create table 1          var string = 'create table if not exists table1 (col1 text not null default "nothing", col2 text not null default "nothing");'           this.db.transaction(               enyo.bind(this,(function (transaction) {                //transaction.executesql('drop table if exists table1;', []);                   transaction.executesql(string, [], enyo.bind(this,this.createtabledatahandler), enyo.bind(this,this.errorhandler));               }))           );       }       catch (e)       {          this.$.results.setcontent(e);       }    },    filltable: function() {        this.$.results.setcontent('0');       this.nullhandlecount = 0;       var string = 'insert table1 (col1, col2) values (" ajay ","  value2 ");'          this.db.transaction(            enyo.bind(this,(function (transaction) {                transaction.executesql(string, [], enyo.bind(this,this.createrecorddatahandler), enyo.bind(this,this.errorhandler));            }))        );    },    doquery: function() {       // query table1       var mytext = 'select * table1;'        this.db.transaction(            enyo.bind(this,(function (transaction) {                transaction.executesql(mytext, [], enyo.bind(this,this.setuprow), enyo.bind(this,this.errorhandler));            }))        );    },    createtabledatahandler: function(transaction, results)    {       this.$.results.setcontent("created table1.");    },    createrecorddatahandler: function(transaction, results)    {          this.$.results.setcontent("inserted 1 record.");    },    setuprow: function(transaction, results)    {         var string = "";       try {           var list = [];          (var = 0; < results.rows.length; i++) {             var row = results.rows.item(i);              //alert(results.rows.item(i).col1);             //alert(results.rows.item(i).col2);             this.$.caption1.setcontent(results.rows.item(i).col1);             this.$.caption2.setcontent(results.rows.item(i).col1);           }        }       catch (e)       {          this.$.results.setcontent(e);       }     },    errorhandler: function(transaction, error)    {        this.$.results.setcontent('error '+error.message+' (code '+error.code+')');    } }); 

i think need use virtual repeater here: https://developer.palm.com/content/api/reference/enyo/enyo-api-reference.html#enyo.virtualrepeater

which has number of options callbacks - example onsetuprow: "somemethod"

you need call method... populate each row of grid.

what resultsset rightly or wrongly in override of create, create variable varresults = [];

i call method query data e.g.

onclickdata: function(){     // data     this.varresults = recordset;  } 

does help? p.s. dont appreciate emailing personal email address , asking questions!


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -