Question

Is this possible to add custom property in Titanium.UI.PickerRow?

In code below, I want to add custom property "index" (using applyProperties PickerRow method)

var daysRows = [];
for (var i = 0, j = days.length; i < j; i++) {
    var currentRow = Ti.UI.createPickerRow({
                    title : days[i],

    });

           //adding custom property to identify selection
    currentRow.applyProperties({index:i});

    daysRows.push(currentRow);
};

But when iterating through that PickerRow object later, I could not get custom property index. What I am seeing is only Titanium properties title.

I am using code below to iterate available properties.

button.addEventListener('click', function(e) {
          ..............
        var selectedRow = picker.getSelectedRow(2);

            for (var k in selectedRow) {
            Ti.API.info('key is: ' + k + ', value is: ' + selectedRow[k]);      
        }
    });

What am I doing wrong? Is there any way I can add custom property in PickerRow?

Était-ce utile?

La solution 2

This is Titanium/Appcelerator issue in Android platform.

This issue seen in Titanium SDK 3.1.1 and not fixed in 3.1.2 August 2013 release.

Update

jira.appcelerator.org/browse/TIMOB-14285 is now closed. This operation should work Release 6.1.0 onwards.

Autres conseils

This is old, but I am having similar issues. What I found as a workaround was to pass in the properties on creation rather than applying

Ti.UI.createPickerRow({title: 'My Row', customId: 1});

This may not suit everybody, but worked for me

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top