Javascript 如何在android listView中添加嵌套的子模板?

Javascript 如何在android listView中添加嵌套的子模板?,javascript,android,listview,titanium,titanium-mobile,Javascript,Android,Listview,Titanium,Titanium Mobile,我有这样的代码: var listViewRowTemplate = { properties: { height: '100dp' }, childTemplates: [ { //lblIndicator type: 'Ti.UI.Label', bindId:'lblIndicator',

我有这样的代码:

    var listViewRowTemplate = {
        properties: {
            height: '100dp'
        },
        childTemplates: [
            {
                //lblIndicator
                type: 'Ti.UI.Label',
                bindId:'lblIndicator',
                properties: {}
            },
            {
                //lblCustomer
                type: 'Ti.UI.Label',
                bindId:'lblCustomer',
                properties: {}
            },
            {
                //menu View
                type: 'Ti.UI.View',
                bindId:'menuView',
                properties: {},
                childTemplates: [
                    {
                        //lblName
                        type: 'Ti.UI.Label',
                        bindId:'lblName',
                        properties: {}
                    }
                ]
            }
        ]
    };

    var section = Ti.UI.createListSection({});
    var listView = Ti.UI.createListView({
        top:'175dp',
        height:Ti.UI.FILL,
        templates: { 'listViewRowTemplate': listViewRowTemplate },
        sections: [ section ]
    });
我用以下代码填充该列表视图:

var listViewRow;


        listViewRow = {
            template:'listViewRowTemplate',
            properties:{backgroundColor:'green'},
            _data:myData,
            lblIndicator:_globals.get('combine')(_styles.get('label.normal'), {
                _id:'indicator',
                left:'10dp',
                backgroundImage:bgIndicator,
                backgroundSelectedImage:bgIndicatorHover,
                height:'40dp',
                width:'40dp',
                top:'5dp'
            }),
            lblCustomer:_globals.get('combine')(_styles.get('label.normal'), {
                _id:'customer',
                text:myData[i].CustomerShortDesc,
                left:'50dp',
                top:'0dp',
                height:'50dp'
            }),
            menuView:_globals.get('combine')(_styles.get('view.tableview.header'), {
                _id:'menu',
                left:'10dp',
                height:'40dp',
                width:_globals.get('app.platformWidth') * 0.7,
                top:'50dp',
                lblName:_globals.get('combine')(_styles.get('label.normal'), {
                    _id:'name',
                    left:'10dp',
                    text:'This is for name',
                    color:'red',
                    height:'40dp',
                    width:'40dp',
                    top:'5dp'
                })
            })
        };

        listViewData.push(listViewRow);

        section.setItems(listViewData);
关于您的信息,
\u globals.get()
\u styles.get()
是我自己的自定义JS文件,返回属性或对象

我可以看到我的其他组件,如lblIndicator、lblCustomer和menuView,但看不到我的嵌套组件(lblName)

有人知道如何用嵌套组件(childTemplates中的childTemplates)填充listview吗

请给我一些建议。。非常感谢..

我找到了解决办法。。 以下是工作代码:

var listViewRow;


        listViewRow = {
            template:'listViewRowTemplate',
            properties:{backgroundColor:'green'},
            _data:myData,
            lblIndicator:_globals.get('combine')(_styles.get('label.normal'), {
                _id:'indicator',
                left:'10dp',
                backgroundImage:bgIndicator,
                backgroundSelectedImage:bgIndicatorHover,
                height:'40dp',
                width:'40dp',
                top:'5dp'
            }),
            lblCustomer:_globals.get('combine')(_styles.get('label.normal'), {
                _id:'customer',
                text:myData[i].CustomerShortDesc,
                left:'50dp',
                top:'0dp',
                height:'50dp'
            }),
            menuView:_globals.get('combine')(_styles.get('view.tableview.header'), {
                _id:'menu',
                left:'10dp',
                height:'40dp',
                width:_globals.get('app.platformWidth') * 0.7,
                top:'50dp'
            }),
            lblName:_globals.get('combine')(_styles.get('label.normal'), {
                _id:'name',
                left:'10dp',
                text:'This is for name',
                color:'red',
                height:'40dp',
                width:'40dp',
                top:'5dp'
            })
        };

        listViewData.push(listViewRow);

        section.setItems(listViewData);
非常感谢。。希望对你有帮助