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

listView with input fields and strange behavior

$
0
0

Hello community,

I'm getting a strange bug / behavior when working with listviews and listitems with textfields.

This is my template:

{
        properties: {
            canEdit: true,
            selectionStyle: Ti.UI.iPhone.ListViewCellSelectionStyle.NONE,
            accessoryType: Ti.UI.LIST_ACCESSORY_TYPE_NONE
        },
        childTemplates: [
            {
                type: 'Ti.UI.TextField',
                bindId: 'name',
                properties: {
                    hintText: L('Name'),
                    color: Ti.App.config.colors.blue,
                    textAlign: Ti.UI.TEXT_ALIGNMENT_RIGHT,
                    value: '',
                    left: 0,
                    font: {
                        fontSize: 12.5
                    },
                    paddingLeft: 15,
                    width: 105,
                    height: 40
                },
                events: {
                    change:function(e){
            // doing more stuff
                    }
                }
            },
            {
                type: 'Ti.UI.TextField',
                bindId: 'value',
                properties: {
                    hintText: L('Value (optional)'),
                    value: '',
                    left: 113,
                    font: {
                        fontSize: 12.5
                    },
                    color: '#000',
                    width: Ti.UI.FILL,
                    height: 40
                },
                events: {
                    change: function(e){
            // doing more stuff
                    },
                    focus: function (e) {
 
                    }
                }
            }
        ]
    }
The first time, when I add this itemtemplate to a section with
var sections = listView.getSections();
        var section = sections[0];
        section.appendItems([
            {
                properties: {
                    itemId: 'new'
                }
            }
        ]);
everthing looks fine. then I enter values to the fields. On adding the same template again, the inputs a pre-filled with the previous values.

Image example:

example

What is that and how can I fix that?


Viewing all articles
Browse latest Browse all 8068

Trending Articles



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