1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    50
    Vote Rating
    1
    scheid is on a distinguished road

      0  

    Default displaying a badge on arbitrary elements (non-components)

    displaying a badge on arbitrary elements (non-components)


    Hi all,

    I have seen the convenient way to set badge text on components using a setBadge method.

    I need a way to create a badge for non-components. Basically I have a DataView that creates an icon grid from store data. That works fine. But I want to be able to show a badge on some of those icons which are just dom elements. In looking at the generated source, I see that the dataview does not create actual ext components of each of the items, so doesn't seem like there is a setBadge method for me to call on a given item. I tried to do it manually, by setting the class 'x-badge' on one of my divs, but it didn't have any effect.

    Any help is appreciated.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,599
    Vote Rating
    434
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    In your template, create a <div> that is positioned where you want it and with the text you want.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

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

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

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

  3. #3
    Sencha User
    Join Date
    Dec 2011
    Posts
    50
    Vote Rating
    1
    scheid is on a distinguished road

      0  

    Default


    Thanks for the reply. OK, so seems that I'll need to do it manually in the template; easy enough. Is there a css class that I can apply to the div so that it stays consistent in appearance with the badge added by setBadge?

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,599
    Vote Rating
    434
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    I would forget about the badge, most likely you will need to write your own CSS
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

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

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

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