Search code examples
androidtitaniumappceleratorappcelerator-mobile

Titanium android keyboard deletes table title


I have the following code to create a table from the database:

    depAgregarButton.addEventListener('click', function(e){
        //dataBase('create', null),
        dataBase('insert', depNamesField.value );
        var databaseObj = new dataBase('query', null),
            data = []; 
        for(var i in databaseObj ){
            var row = Ti.UI.createTableViewRow({
                title: databaseObj[i]
            });
            data.push(row);
        };
        table.data = data;
    });

It creates the table perfectly as desired: But when I open the keyboard: It deletes the titles from the table where the keyboard was over: enter image description here

Any ideas what is going on?


Solution

  • Try using TableView.setData() method or even better TableView.appendRow().
    Notice that you can pass whole array of new rows to appendRow() and call it only once - it will give you better performance.