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

update a Tableview

$
0
0

I have a Tableview with some rows. I can use "hasCheck" when i click the Tableview. The problem is i only need one row selected with "hasCheck", and when i select one the other must be unselect (hasCheck=false). How i can update the Tableview???

Thanks

tabla.xml

<TableView id="MenuLateral" top="6%" height="0%" left="0%" zindex="20" width="100%" backgroundColor="white" separatorColor="gray">
        </TableView>

tabla.js

var db = Ti.Database.open('Termolink');
    var rows = db.execute('SELECT * FROM Termostatos ORDER BY Termostatos.Nombre');
 
    NRegistros=ComprueboRegBD();
 
    var RowsTabla=[];
    var i;
 
    for (i=0;i<NRegistros;i++){
        TablaNombreTermostatos[i]= rows.field(2);
 
        var nuevaRow=Ti.UI.createTableViewRow({height:40});
        var titulo=Ti.UI.createLabel({
            id: "NombreTerm",
            text: "       "+rows.field(2),
            color: "black" ,
            textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT, 
            left:2
        });
        nuevaRow.add(titulo);
        RowsTabla.push(nuevaRow);
 
        rows.next();
    }
 
    $.MenuLateral.setData(RowsTabla);
 
 
 
$.MenuLateral.addEventListener('click', function(e){
 
                if (e.source.hasCheck=="true") {
                    e.source.hasCheck="false";
                }
                else {
                    e.source.hasCheck="true";
                }
});

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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