0

ストアに 2 つのフィールドがあります。1. タイトルと 2. アクティブなブール値です。

私は以下のext.templateを持っています

itemTpl : Ext.create('Ext.XTemplate',
                 '<div style = "height:5px; border-top: 0px solid #DEDEDE;">',
                    '<div style="float:left" >',
                        '<input type ="image" src="images/sort-ascending-default.png" id = "img1"  name ="img1" width="30px" height="30px" />',
                    '</div>',
                    '<div  class="itemTitle" id="itemTitle" style="float:left;width: 70%;height: 20px;text-align: center;  color :#fffff0;">{title}</div>',
                    '<div style="float:right;  vertical-align:middle;">',
                        '<input type ="image" src="images/sort-descending-default.png" id = "img2" name ="img2" width="30px" height="30px"/>',
                    '</div>',
                    '<div style="clear:both"></div>',
                 '</div>'),

if条件を入れて、アクティブフィールドをチェックしてタイトルの色を変えたいのですが、ストアフィールドの値にアクセスする方法がわかりません。

4

1 に答える 1

0

tpl で if 条件を使用する方法は次のとおりです。

itemTpl : Ext.create('Ext.XTemplate',
             '<div style = "height:5px; border-top: 0px solid #DEDEDE;">',
                '<div style="float:left" >',
                    '<input type ="image" src="images/sort-ascending-default.png" id = "img1"  name ="img1" width="30px" height="30px" />',
                '</div>',
                '<tpl if="active == true">',
                    '<div  class="itemTitle" id="itemTitle" style="float:left;width: 70%;height: 20px;text-align: center;  color :red;">{title}</div>',
                '<tpl else>',
                    '<div  class="itemTitle" id="itemTitle" style="float:left;width: 70%;height: 20px;text-align: center;  color :green;">{title}</div>',
                '</tpl>'
                '<div style="float:right;  vertical-align:middle;">',
                    '<input type ="image" src="images/sort-descending-default.png" id = "img2" name ="img2" width="30px" height="30px"/>',
                '</div>',
                '<div style="clear:both"></div>',
             '</div>'),
于 2013-04-24T05:22:32.257 に答える