app type:mobile,android,titanium sdk:3.2.2.GA
Hello, I have a problem with my android application: I have more windows,in one window,i insert data into a sqlite database table,in an another window i have a picker which returns the data from a column of the same table.When i insert new lines in the table the data from the picker doesn't update.What should i do?How can i update the content of the picker? And another question:how can i insert a selected value from a picker into a table?
Here is the code:
var win1 = Titanium.UI.createWindow({ title:'Currency Prices', backgroundColor:'#000' }); function createCurrencyPicker() { var currencyPicker = Ti.UI.createPicker( {height :'40%', selectionIndicator : true}); // populate the picker from the SQLite currencies // Database file already exists so we need to use install, //to copy it to the internal storage var db = Ti.Database.open('client.db', 'clienti'); var data = db.execute ('SELECT nume FROM clienti;'); var pickRow = []; var i = 0; while (data.isValidRow()) { pickRow[i++] = Ti.UI.createPickerRow ({title:data.fieldByName('counter')}); data.next(); } data.close(); db.close(); currencyPicker.add(pickRow); return currencyPicker; }; //var vertLayout = Ti.UI.createView({layout:'vertical'}); //var stockList = Ti.UI.createTableView({}); var picker = createCurrencyPicker(); //vertLayout.add(picker); //vertLayout.add(stockList); win1.add(picker); win1.open();