Hybrid View

  1. #1
    Sencha User
    Join Date
    Oct 2013
    Location
    Minsk
    Posts
    39
    Vote Rating
    0
    samaelal is on a distinguished road

      0  

    Default How to insert a picture on the condition itemtpl

    How to insert a picture on the condition itemtpl


    Hello! Please tell me how to insert a picture on a condition in Itemtpl. I tried to insert a function but does not work ... Thanks in advance.


    Code:
    itemTpl :
                              '<img src="{this.resolveImage(values)}" width=100 height=80 margin-left=50px>'
                             +'<b style="color:#F00">{f1} {mode} {f2} {f3}</b>'
                             +'<p style=color:Gray style=font-size:40px style=font-weight:bold>{f14}</p>'
                             +'<p style=color:Gray style=font-size:40px style=font-weight:bold>{f4} {f13}</p>',
    
                               resolveImage: function () {
                                   if (value.mode == cp && value.f2 == 2 && value.f3 == 0) {
                                       return 'resources/images/goods-dlv.png';
                                   }
                                   return 'resources/images/goods-cap.png';
    
                               },

  2. #2
    Sencha User
    Join Date
    Jul 2013
    Posts
    99
    Vote Rating
    10
    tt88 will become famous soon enough

      1  

    Default


    Change your code slightly to include square brackets when referencing a function + include the argument in your function:

    Code:
    itemTpl :                          '<img src="{ [this.resolveImage(values)] }" width=100 height=80 margin-left=50px>'
                             +'<b style="color:#F00">{f1} {mode} {f2} {f3}</b>'
                             +'<p style=color:Gray style=font-size:40px style=font-weight:bold>{f14}</p>'
                             +'<p style=color:Gray style=font-size:40px style=font-weight:bold>{f4} {f13}</p>',
    
    
                               resolveImage: function (value) {
                                   if (value.mode == cp && value.f2 == 2 && value.f3 == 0) {
                                       return 'resources/images/goods-dlv.png';
                                   }
                                   return 'resources/images/goods-cap.png';
    
    
                               },

  3. #3
    Sencha User
    Join Date
    Oct 2013
    Location
    Minsk
    Posts
    39
    Vote Rating
    0
    samaelal is on a distinguished road

      0  

    Default


    still fails to establish code .... the list is not displayed. but rather appears empty .... have empty time ...

    bring clarity to the whole JS....


    Code:
    Ext
            .define(
                    'MM.view.Contacts',
                    {
                        extend : 'Ext.List',
                        xtype : 'contacts',
                        //id    : 'titleform',
                        config : {
                            title : 'Все отправки ',
                            id: 'homeTab',
                            store : 'otprStore',
                            itemTpl :                          '<img src="{ [this.resolveImage(values)] }" width=100 height=80 margin-left=50px>'
                                +'<b style="color:#F00">{f1} {mode} {f2} {f3}</b>'
                                +'<p style=color:Gray style=font-size:40px style=font-weight:bold>{f14}</p>'
                                +'<p style=color:Gray style=font-size:40px style=font-weight:bold>{f4} {f13}</p>',
    
    
                            resolveImage: function (value) {
                                if (value.mode == cp && value.f2 == 2 && value.f3 == 0) {
                                    return 'resources/images/goods-dlv.png';
                                }
                                return 'resources/images/goods-cap.png';
    
    
                            }
                             +'<br><b style="color:#F00">{f1} {mode} {f2} {f3}</b>'
                             +'<p style=color:Gray style=font-size:40px style=font-weight:bold>{f14}</p>'
                             +'<p style=color:Gray style=font-size:40px style=font-weight:bold>{f4}</p>'
                             +'<p style=color:Gray style=font-size:40px style=font-weight:bold>{f13}</p>',
    
    
    
    
    
                            items : [ {
                                xtype : 'toolbar',
                                docked : 'bottom',
                                scrollable : {
                                    direction : 'horizontal',
                                    indicators : false
                                },
                                layout : {
                                    pack : 'center',
                                    align : 'center'
                                },
                                defaults : {
                                    ui : 'plain'
                                },
    
                                items : [
                                        {
                                            xtype : 'button',
                                            text : '',
                                            action : 'logout', // ВЫХОДИМ ИЗ
                                            // АККАУНТА
                                            iconCls : 'delete',
                                            ui : 'decline'
                                        },
                                        {
                                            xtype : 'button',
                                            iconCls : 'arrow_left',
                                            id : 'namebutton',
                                            ui : 'back',
                                            handler : function() {
                                                //Ext.getCmp('titleform').setTitle('Забор');
                                                var sto = Ext.getStore('otprStore');
                                                sto.clearFilter();
                                                sto.filter('mode', 'cp');
                                                Ext.Msg    .alert(
                                                                'MM-Express',
                                                                'Сортированка на забор отправок',
                                                                Ext.emptyFn);
                                               // Ext.getCmp('Отправки').setTitle('Забор');
                                            },
                                            listeners: {
                                            tap: function(button){
                                                var homeTab = button.getParent();
                                                homeTab.tab.setTitle('Забор');
                                            }
                                        }
                                        },
                                        {
                                            xtype : 'button',
                                            iconCls : 'arrow_right',
                                            ui : 'forward',
                                            handler : function() {
                                                //Ext.getCmp('titleform').setTitle('Доставка');
                                                var sto = Ext.getStore('otprStore');
                                                sto.clearFilter();
                                                sto.filter('mode', 'dv');
                                                Ext.Msg
                                                        .alert(
                                                                'MM-Express',
                                                                'Сортированка на доставку отправок',
                                                                Ext.emptyFn);
                                            },
                                            listeners: {
                                                tap: function(button){
                                                    var homeTab = button.getParent();
                                                    homeTab.tab.setTitle('Доставка');
                                                }
                                        }
                                        },
                                        {
                                            xtype : 'button',
                                            iconCls : 'team',
                                            ui : 'action',
                                            handler : function() {
                                                //Ext.getCmp('titleform').setTitle('Все отправки');
                                                Ext.getStore('otprStore')
                                                        .clearFilter();
                                                Ext.Msg.alert('MM-Express',
                                                        'Весь список отправок',
                                                        Ext.emptyFn);
                                            },
                                            listeners: {
                                                tap: function(button){
                                                    var homeTab = button.getParent();
                                                    homeTab.tab.setTitle('Все отправки');
                                                }
                                        }
                                        },
                                        {
                                            xtype : 'button',
                                            iconCls : 'refresh',
                                            ui : 'action',
                                            id : 'reload'
    
                                        } ]
                            } ]
    
                        }
    
                    });

  4. #4
    Sencha User
    Join Date
    Oct 2013
    Location
    Minsk
    Posts
    39
    Vote Rating
    0
    samaelal is on a distinguished road

      0  

    Default


    pls help me...

  5. #5
    Sencha User
    Join Date
    Jul 2013
    Posts
    99
    Vote Rating
    10
    tt88 will become famous soon enough

      1  

    Default


    1. Can you get it to work with a simple list item, not using a function?
    2. Is it a layout/display? Try setting the minHeight of your list, to make sure it is not a list size issue. Eg. minHeight:'200px' in the config for the list.

  6. #6
    Sencha User
    Join Date
    Oct 2013
    Location
    Minsk
    Posts
    39
    Vote Rating
    0
    samaelal is on a distinguished road

      0  

    Default


    I get this:
    I get Data from JSON there is the value of "mode" "f2" "f3" fashion on him and is determined by what the picture wakes. It turns out like the picture.

    Why is that instead of a picture put [Object object]

    Безымянный.jpg

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi