0

I am developing my application in Sencha touch. In that I have a list and Picker and I want to update the list data dynamically when selecting the picker i.e., I want to add data to list dynamically when tap on 'Done' button of Picker. I used some logic for this but this doesn't update the list content.

 listeners: {
                            change: function(picker,value) {
                                textValue = picker.getValue()['name'];
                                var me = this,
                                nameList = this.down('#namesList');
                                nameList.add({fullname:textValue}) ;

                            }
                       }

When I update like this, it throws me the error that 'Uncaught TypeError: Cannot call method 'add' of null' eventhough 'namesList' is already defined. Please show me the way to solve this problem.

smily
  • 357
  • 1
  • 7
  • 18
  • are you referencing your `nameList` correctly? Can you also provide your code for `#namesList`. It maybe helpful. – cclerv Jun 01 '13 at 17:41

1 Answers1

0

I would add a record to the data/store of the list, and then capture the list and refresh.

The issue there is that nameList isnt actually the list component. Try adding for example an id to the list, and then in the picker change listener:

Ext.getCmp('mylist-id').refresh()

Hope it helps.

Nico Grunfeld
  • 1,133
  • 1
  • 8
  • 19