1. #1
    Sencha User
    Join Date
    Oct 2010
    Location
    Malmö, Sweden
    Posts
    2
    Vote Rating
    0
    olagunnarsson is on a distinguished road

      0  

    Question Style an Ext.Template depending on value

    Style an Ext.Template depending on value


    Hi,

    I would like to make an Ext.Template, where the style {css} should depend on the {value}.

    For example if the {value} exceeds 5 the output will be red otherwise black.

    Code:
    this.cellTpl = new Ext.Template(
                    '<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} {css}" style="{style}">',
                    '<div class="x-grid3-cell-inner x-grid3-col-{id}" unselectable="on">{value}</div>',
                    "</td>"
                );
    ...the example above is from the Ext.ux.GroupSummary and it is also there I would like to change the template as I explained.

    Does anyone have any suggestions on how to do this?

    Thanks in advance.

    //Ola
    I Have been working with Lotus Notes and web applications since 2000 and have several years' experience in development, design and testing. Since November 2010 I'm working full-time with Ext JS 3.

  2. #2
    Sencha - Services Team AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Posts
    1,394
    Vote Rating
    22
    AndreaCammarata has a spectacular aura about AndreaCammarata has a spectacular aura about

      0  

    Default


    Hi olagunnarsson.
    You are posting your issue in the wrong forum.
    This is Sencha Touch forum, you should post in Ext Help forum.

    However to do what you ask for you should use XTemplate instead Template.
    XTemplate in fact, supports conditional processing, so you can write

    Code:
    this.cellTpl = new Ext.XTemplate(
        '<tpl if="value <= 5">',
            '<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} blackText>',
         '</tpl>',
         '<tpl if="value > 5">',
             '<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} redkText>',
         '</tpl>',
             '<div class="x-grid3-cell-inner x-grid3-col-{id}" unselectable="on">{value}</div>',
         "</td>"
    );
    Hope this helps.
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    CEO at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata

    TUX components bundle for Sencha Touch 2.x.x
    http://www.tux-components.com/


  3. #3
    Sencha User
    Join Date
    Oct 2010
    Location
    Malmö, Sweden
    Posts
    2
    Vote Rating
    0
    olagunnarsson is on a distinguished road

      0  

    Default


    Ooppss ... ok I'm sorry. Next time I will post in the right Forum.

    But anyway thanks for you answer. This was what I was looking for!

    Thank you!

    Best Regards
    Ola
    I Have been working with Lotus Notes and web applications since 2000 and have several years' experience in development, design and testing. Since November 2010 I'm working full-time with Ext JS 3.

  4. #4
    Sencha - Services Team AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Posts
    1,394
    Vote Rating
    22
    AndreaCammarata has a spectacular aura about AndreaCammarata has a spectacular aura about

      0  

    Default


    No problem .
    You are welcome.
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    CEO at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata

    TUX components bundle for Sencha Touch 2.x.x
    http://www.tux-components.com/


Similar Threads

  1. Ext.DomHelper.Template: one template, ten YUI grids
    By moraes in forum Community Discussion
    Replies: 11
    Last Post: 18 Dec 2012, 4:55 AM
  2. Help Getting Start with Custom Template Menu Style Popup
    By epinc in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 25 Jul 2010, 9:39 AM
  3. extjs and template based development style ?
    By garyng in forum Community Discussion
    Replies: 10
    Last Post: 1 Oct 2008, 8:41 AM
  4. Replies: 1
    Last Post: 15 Aug 2008, 2:21 AM
  5. [SOLVED] Ext.Template and style property
    By amon in forum Ext 1.x: Bugs
    Replies: 6
    Last Post: 3 Sep 2007, 12:22 PM

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar