0

「if」ステートメントに依存する itemTpl に画像を追加しようとしています。誰でもこの問題を解決するのを手伝ってもらえますか?

ここに私のコードがあります、

//Controller
for(var i=0;i<len;i++){  
 //Storing our values in Array      

var st =  {
'Amount':jsonarr.AgentTransactionResult[i].Amount,
'TransactionId':jsonarr.AgentTransactionResult[i].TransactionId,
'Status':jsonarr.AgentTransactionResult[i].Status,
'Date':jsonarr.AgentTransactionResult[i].Date,
            };  
//Adding our array to LocalStore(localStorage)
var localStore = Ext.getStore('transstore');
localStore.add(st);
localStore.sync();
localStore.load();  
}//for loop

//View

xtype: 'list', store : 'transstore', html:'<table border="0" width="100%"><th><td width="25%">Amount</td><td width="25%">Status</td><td width="25%">Date</td><td width="25%">Transaction Id</td></th></table>', itemTpl:
'<table border="0" width="100%">'+
'<tr>'+
'<td width="10%"><font size="2" color="#000000"><b>{Amount}</b></font></td>'+
'<td width="20%"><font size="2" color="#003300"><b>{Status}</b></font></td>'+
'<td width="23%"><font size="2" color="#003300"><b>{Date}</b></font></td>'+
'<td width="8%"><font size="2" color="#003300"><b>{TransactionId}</b></font></td>'+
'</tr>'+
'</table>'.

ステータスを画像形式で表示する必要があります。if(status=="Success") return "img url" それ以外の場合は "別の img url" を返します。Web サービスからステータスを取得しましたが、画像を変更する方法がわかりません。誰でもこれで私を助けることができますか?

4

1 に答える 1

0

この回答を参照してください。

また、質問がフォーマットされていると、回答がはるかに簡単になります。

それが機能しない場合は、例を再フォーマットして、if ステートメントでチェックしているものを教えてください。例をまとめてみます。

がんばれ、ブラッド

于 2013-07-15T15:04:49.087 に答える