1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    15
    Answers
    1
    Vote Rating
    1
    crsssl is on a distinguished road

      0  

    Default Answered: List update without a store

    Answered: List update without a store


    I've tried umpteen number of ways to do this, but it would seem you can't get a list to refresh once the data has been updated. It works automatically when binding the list to a store, but not when the "fields" and "data" properties are defined, i.e.:

    {
    xtype: 'list',
    itemId: 'mainlist',
    itemTpl: '<div>{text} {val}</div>',
    fields: ['text', 'val'],
    data: [
    { text: 'Property1', val:'0' },
    { text: 'Property2', val:'0' }
    ]
    }

    Of course, in my controller I've tried:

    myRefresh(): function () {
    var data = this.getMainlist().getData();
    data[0].val = '555'; // <-- some arbitrary value
    this.getMainlist().setData(data)
    this.getMainlist().initComponent();
    this.getMainlistView().refresh();
    }

    ... not to mention all kinds of other ways. The 'data' property of the list has indeed been changed (as I can see in my debugger), but the new data doesn't show up on the view/list.


    Note: I don't want to set up a separate store just for the list items (to bind to). Tried it. That seemed to introduce a whole host of problems I don't even want to get into (e.g. store arbitrarily getting deleted). I just want to keep this simple and all inline/in-code, and using refresh() or some other event.

    Has anybody done this? Has anybody solved this? Do I have to do some jQuery/DOM manipulation (which I would rather avoid)?

    Any help is appreciated. Thanks.

  2. Who knew I could have a store without a Store?
    That worked wonderfully. I'm very grateful.

  3. #2
    Sencha User
    Join Date
    Sep 2012
    Posts
    15
    Answers
    1
    Vote Rating
    1
    crsssl is on a distinguished road

      0  

    Default Already tried XTemplate.overwrite method, btw

    Already tried XTemplate.overwrite method, btw


    I've tried the XTemplate 'overwrite' method, but that didn't seem to do anything. Maybe I don't have the right 'el' (element) as the first parm, or maybe I have to do some special kind of re-display of the list/panel, I don't know. If someone has successfully done this, walk me through the exact steps. Thanks.

  4. #3
    Sencha User
    Join Date
    Feb 2011
    Location
    Düsseldorf, Germany
    Posts
    584
    Answers
    34
    Vote Rating
    32
    Kurt001 has a spectacular aura about Kurt001 has a spectacular aura about

      1  

    Default You do have a store

    You do have a store


    Hi,
    once you created the list you do have a list.
    Ext.Viewport.down('.list').getStore()

    Within that you might be able to change the records:
    getStore().findRecord('text', 'Property2').set('text','PropertyX')

    This should automatically update your list.

  5. #4
    Sencha User
    Join Date
    Sep 2012
    Posts
    15
    Answers
    1
    Vote Rating
    1
    crsssl is on a distinguished road

      0  

    Default Thank you

    Thank you


    Who knew I could have a store without a Store?
    That worked wonderfully. I'm very grateful.

  6. #5
    Sencha User
    Join Date
    Feb 2011
    Location
    Düsseldorf, Germany
    Posts
    584
    Answers
    34
    Vote Rating
    32
    Kurt001 has a spectacular aura about Kurt001 has a spectacular aura about

      0  

    Default


    btw: marking your answer as the best answer might be not too helpful for others with the same question.

  7. #6
    Sencha User
    Join Date
    Sep 2012
    Posts
    15
    Answers
    1
    Vote Rating
    1
    crsssl is on a distinguished road

      0  

    Default Slip of the mouse

    Slip of the mouse


    Sorry, pressed the wrong button. If this can be fixed, let me know.

Thread Participants: 1

Tags for this Thread