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

Accordion pan dynamic - Click event problem.

$
0
0

I have to make accordion on run time. As per the data In JSON I have to create accordion panel, I had implemented few things which creates accordion pan perfectly as per JSON length , but I have problem in showing tableView inside each view when I click on view(TableView should be show and hide).

in my AccountEx.js

Ti.App.addEventListener("sliderToggled", function(e) {
    if (e.hasSlided) {
        $.viewAccountType.touchEnabled = false;
    } else {
        $.viewAccountType.touchEnabled = true;
    }
});
 
var AccountType = [{
    id : 'Saving',
    image : '/oneviewimages/bank.png',
 
}, {
    id : 'Current',
    image : '/oneviewimages/bank1.png',
 
}, {
    id : 'Salary',
    image : '/oneviewimages/bank2.png',
 
}, {
    id : 'Personal',
    image : '/oneviewimages/bank2.png',
 
}];
 
for (var i = 1; i <= AccountType.length; i++) {
    var row = createRow(i);
    $.scrollAccountType.add(row);
}
 
function createRow(i) {
        var section = Ti.UI.createTableViewSection();
        var row = Ti.UI.createView({
        backgroundColor : '#F2F2F2',
        borderColor : '#bbb',
        borderWidth : 1,
        width : '100%',
        height : "50dp",
 
    });
 
    // Create a Label.
    var aLabel = Ti.UI.createLabel({
        text : 'test' + i,
        color : 'black',
        font : {
            fontSize : 25
        },
        // height : 30,
        // width : '10%',
        top : "10dp",
        left : '10%',
        textAlign : 'left',
 
    });
    var inputTextField = Ti.UI.createTextField({
        hintText : 'Enter value ' + i,
        top : 1,
        //left : '10%',
        height : 0,
        objVisible : false
    });
 
    row.addEventListener('click', function selectRow(e) {
        alert(e.source.children[0].text);
        if ($.tableWin.objVisible == true) {
            $.tableWin.height = 0;
            $.tableWin.objVisible = false;
        } else {
            $.tableWin.height = Ti.UI.SIZE;
            $.tableWin.objVisible = true;
        }
 
    });
    row.add(aLabel);
 
    return row;
}

my AccountEx.xml

<Alloy>
    <View id="viewAccountType" layout="vertical" backgroundColor="#FFF">
        <!-- <Label id="labelAccountType">Account Type Content</Label> -->
        <ScrollView id="scrollAccountType" layout="vertical" showVerticalScrollIndicator="true" >
            <View id="viewTotalBalance" backgroundColor="#CCCCCC">
                <Label id="labelDollar">
                    $
                </Label>
                <Label id="labelTotalBalanceShow" >
                    Show balance
                </Label>
                <Label id="labelTotalBalance">
                    TotalBalance
                </Label>
            </View>
            <TableView top="1" height="0" objVisible="false" id="tableWin">
                <TableViewSection id="sectionFruit" headerTitle="Fruit">
                    <TableViewRow title="Apple"/>
                    <TableViewRow title="Bananas"/>
                </TableViewSection>
                <TableViewSection id="sectionVeg" headerTitle="Vegetables">
                    <TableViewRow title="Carrots"/>
                    <TableViewRow title="Potatoes"/>
                </TableViewSection>
                <TableViewSection id="sectionFish" headerTitle="Fish">
                    <TableViewRow title="Cod"/>
                    <TableViewRow title="Haddock"/>
                </TableViewSection>
                <TableViewSection id="sectionVeg" headerTitle="Vegetables">
                    <TableViewRow title="Carrots"/>
                    <TableViewRow title="Potatoes"/>
                </TableViewSection>
                <TableViewSection id="sectionFish" headerTitle="Fish">
                    <TableViewRow title="Cod"/>
                    <TableViewRow title="Haddock"/>
                </TableViewSection>
            </TableView>
            <Label top="1" id="lblFirst" height="0" objVisible="false" text="LOrum ipsum LOrum ipsumLOrum ipsumLOrum ipsumLOrum ipsumLOrum ipsum LOrum ipsum LOrum ipsumLOrum ipsumLOrum ipsumLOrum ipsumLOrum ipsumLOrum ipsum LOrum ipsumLOrum ipsumLOrum ipsumLOrum ipsumLOrum ipsumLOrum ipsum LOrum ipsumLOrum ipsumLOrum ipsumLOrum ipsumLOrum ipsum" backgroundColor="yellow"/>
        </ScrollView>
    </View>
</Alloy>

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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