Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: prepareData not working in List?

    Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-1176 in a recent build.
  1. #1
    Sencha User
    Join Date
    Nov 2011
    Location
    Toronto
    Posts
    105
    Vote Rating
    2
      0  

    Default prepareData not working in List?

    Both variables show up blank in the template. In regular Ext JS 4, this works perfectly. Is there a new way to do this in Touch 2 or is this a bug?

    Code:
    {    xtype: 'list',
        store: 'SomeStore',
        itemTpl: [
            '<div>{shortTitle}</div>',        '<div>{sometest}</div>'
        ],
        prepareData: function(data) {
            Ext.apply(data, {
                shortTitle: Ext.util.Format.ellipsis(data.name, 7),            sometest: 'Test'
            });
            return data;
        }
    }

  2. #2
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,159
    Vote Rating
    7
      0  

    Default

    This is a bug. I've added it to our bug tracker.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  3. #3
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    19
      0  

    Default

    This has been fixed for the next release.

    Sencha Inc

    Jamie Avins

    @jamieavins

  4. #4
    Sencha User chuckoh's Avatar
    Join Date
    Jan 2012
    Location
    Seoul, Korea
    Posts
    16
    Vote Rating
    0
      0  

    Default just wondering...

    when do you think you guys'll release the prepareData bug fixed version? any rough ideas?

  5. #5
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    19
      0  

    Default

    I can't give any dates as of yet, should be soon though.

    Sencha Inc

    Jamie Avins

    @jamieavins

  6. #6
    Sencha Premium Member
    Join Date
    Dec 2011
    Posts
    33
    Vote Rating
    0
      0  

    Default Is this really fixed?

    I'm using version 2.0.1.1 and am running into this problem using an Ext.dataview.List instance, where prepareData is not being called at all.

    Is the fix in some other version or have I found something else?

    Code:
    var cfg = {
        extend:'Ext.dataview.List';
        config: {
           store: myStore;
            itemTpl: [
                  '<tpl for=".">',
                      '<div class="requests-wrap x-data-item" id="request-{ID}">',
                          '{title}',
                          '<span>{summary}</span>',
                          '<span>{subject}</span>',
                      '</div>',
                  '</tpl>',
                  '<div class="x-clear"></div>'
            ].join(''),
    
            prepareData: function(data, recordIndex, record) {
                // Never called
                Ext.apply(data, {
                    title: "My Title,
                    summary: "My Summary"
                });
                return data;
            },        
        }
    }
    Ext.define('myName', cfg);

    Thanks,
    Neil

  7. #7
    Sencha Premium Member
    Join Date
    Dec 2011
    Posts
    33
    Vote Rating
    0
      0  

    Default

    Did anyone that had this problem earlier get a fix in a later release?
    Is there a workaround?

    Thanks,
    Neil

  8. #8
    Sencha User
    Join Date
    Mar 2008
    Posts
    71
    Vote Rating
    0
      0  

    Default Broken in RC1

    RC1 doesn't use the data from prepareData to actually populate the itemTpl. prepareData gets called by the DataItem class but then the ListItem call ListItem.getBody().setRecord(record) which is what results in rendering of the itemTpl the ListItem.getBody() does not have the prepareData but only a getData(true).

  9. #9
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    11
      0  

    Default

    This has been fixed for the next release. Thanks for the report.

  10. #10
    Sencha User
    Join Date
    May 2007
    Posts
    25
    Vote Rating
    1
      1  

    Default

    And which release is that? You posted in October 2012. This is March 2013, using Sencha Touch 2.1.1 and the function still does not get called.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •