Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Oct 2013
    Posts
    4
    Vote Rating
    0
    delysh is on a distinguished road

      0  

    Default addCls() stopped working in 2.3.1

    addCls() stopped working in 2.3.1


    Touch version tested:
    • Touch 2.3.1
    Browser versions tested against:
    • Chrome 31.0
    • Safari 6.1
    DOCTYPE tested against:
    • ____
    Description:
    • addCls() function doesn't add class to DOM elements. In Touch v 2.2.1 worked fine. After update to 2.3.1 stopped working. Same problem in new generated app.
    Steps to reproduce the problem:

    Ext.define('MyApp.view.ListItemView',{
    extend: 'Ext.dataview.component.ListItem',
    xtype : 'listitemview',

    ....

    updateRecord: function(record) {
    if (!record) {
    return;
    }
    this.addCls('someClass');

    this.callParent(arguments);
    }
    });





    The result that was expected:
    • DOM class "someClass" added to the list items.
    The result that occurs instead:
    • No class added

  2. #2
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,931
    Vote Rating
    130
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    I am unable you reproduce this issue. I have created a fiddle with the test case I used.
    Touch 2.3.1 is not available in fiddle so you will have to copy the js and css and run it locally.
    Could you please modify this fiddle so that it illustrates the issue you are experiencing.
    https://fiddle.sencha.com/#fiddle/1p0
    Get more personalized support via a support subscription.

    Want to learn Sencha Touch 2? Check out
    Sencha training
    Sencha Touch in Action

    Need more help with your app? Hire Sencha Services services@sencha.com

    When posting code, please use BBCode's CODE tags.

    Need to include a test case use:
    The official Sencha Fiddle

  3. #3
    Sencha User
    Join Date
    Oct 2013
    Posts
    4
    Vote Rating
    0
    delysh is on a distinguished road

      0  

    Default


    Thanks for your reply.
    I'm new to Sencha. When i was building my app i found an example on the web on how to use 'Ext.dataview.component.ListItem'. I used that example and it worked fine. Let me explain what i'm trying to achieve:
    I'm using 'Ext.dataview.component.ListItem' as view for my list item (obviously) and i need to add class to every list item dynamically, depending on the data which i receive from a server. So, my list element would look something like this:

    Ext.create('Ext.List', {
    useSimpleItems: false,
    defaultType: 'listItem',
    store: 'listItemStore'
    });

    And my "ListItem" component - something like this:

    Ext.define('MyApp.view.ListItemView',{
    extend: 'Ext.dataview.component.ListItem',
    xtype : 'listItem',
    config:{

    itemTitle: {
    cls: 'item_title',
    flex: 1,
    },

    layout: {
    type: 'hbox'
    },
    },

    applyItemTitle: function(config) {
    return Ext.factory(config, Ext.Component, this.getItemTitle());
    },
    updateItemTitle: function(newText) {
    if (newText) {
    this.add(newText);
    }
    },

    updateRecord: function(record) {
    if (!record) {
    return;
    }

    this.getItemTitle().setHtml(record.get('item_title'));

    this.addCls(record.get('item_type'), 'sub_');

    this.callParent(arguments);


    }
    });

    I don't know how to create this in the fiddle, so i hope this will help you to reproduce the issue.

  4. #4
    Sencha User
    Join Date
    Oct 2013
    Posts
    4
    Vote Rating
    0
    delysh is on a distinguished road

      0  

    Default


    Hi,I think i've managed to modify the fiddle and achieve what i'm trying to do. It works fine there as well. So, i guess, it's really 2.3.1 problem.

  5. #5
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,931
    Vote Rating
    130
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    Can you send me the url for the fiddle.
    Get more personalized support via a support subscription.

    Want to learn Sencha Touch 2? Check out
    Sencha training
    Sencha Touch in Action

    Need more help with your app? Hire Sencha Services services@sencha.com

    When posting code, please use BBCode's CODE tags.

    Need to include a test case use:
    The official Sencha Fiddle

  6. #6

Thread Participants: 1

Tags for this Thread