Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/463.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何获取listview';s值多少?_Javascript_Android_Listview_Titanium - Fatal编程技术网

Javascript 如何获取listview';s值多少?

Javascript 如何获取listview';s值多少?,javascript,android,listview,titanium,Javascript,Android,Listview,Titanium,我希望获得listview儿童文本,但我找不到获得它的方法。 我的listview生成代码: var myTemplate = { childTemplates: [ { // Title type: 'Ti.UI.Label', // Use a label for the title bindId: 'info', // Maps

我希望获得listview儿童文本,但我找不到获得它的方法。 我的listview生成代码:

var myTemplate = {
    childTemplates: [
            {                            // Title 
            type: 'Ti.UI.Label',     // Use a label for the title 
            bindId: 'info',          // Maps to a custom info property of the item data
            properties: {            // Sets the label properties
                color: 'black',
                font: { fontFamily:'Arial', fontSize: '20dp', fontWeight:'bold' },
                left: 0, top: 0,
            }
        },
        {                            // Subtitle
            type: 'Ti.UI.Label',     // Use a label for the subtitle
            bindId: 'es_info',       // Maps to a custom es_info property of the item data
            properties: {            // Sets the label properties
                color: 'black',
                font: { fontFamily:'Arial', fontSize: '20dp' },
                right: 0, top: '0dp',
                accessoryType: Ti.UI.LIST_ACCESSORY_TYPE_NONE
            }
        }
    ]
};

var table = Ti.UI.createListView({
// Maps myTemplate dictionary to 'template' string
    templates: { 'template': myTemplate },
    bottom:'50dp',
    editing : true,
    defaultItemTemplate: 'template'
});
var sections = [];


ProcuctRS = db.execute('select uniqnumber,barcode,scantimes,quantity from product where batchno=?',Titanium.App.Properties.getString("batchnumber"));
while (ProcuctRS.isValidRow())  
    {  
        var BNO = ProcuctRS.fieldByName('barcode');  
        var SCTIME = ProcuctRS.fieldByName('scantimes');  
        var QUANTITY = ProcuctRS.fieldByName('quantity'); 

        var PDSection = Ti.UI.createListSection({ headerTitle: BNO});
        var PDDataSet = [
                            { es_info: {text: 'Scan times :' + SCTIME}, info: {text: 'Quantity :'+ QUANTITY}},
                        ];
        PDSection.setItems(PDDataSet);
        sections.push(PDSection);
        ProcuctRS.next(); 
    }  
ProcuctRS.close();
table.sections = sections;
self.add(table);
现在我想更改信息和es_信息文本,我尝试了不同的方法, 例如:

    table.addEventListener('itemclick', function(e){
            var item = e.section.getItemAt(e.itemIndex);
            e.section.es_info.color = 'orange';
            e.section.updateItemAt(e.itemIndex, item); 
};
但它不起作用。
我能做什么?救命!谢谢你

我不知道这是否相关(或者只是复制粘贴错误),但你在事件侦听器的结尾遗漏了“')

 table.addEventListener('itemclick', function(e){
        var item = e.section.getItemAt(e.itemIndex);
        e.section.es_info.color = 'orange';
        e.section.updateItemAt(e.itemIndex, item); 
 });
尝试编辑:false

    var table = Ti.UI.createListView({
        // Maps myTemplate dictionary to 'template' string
        templates: { 'template': myTemplate },
        bottom:'50dp',
        editing : false,
        defaultItemTemplate: 'template'
    });