これにはいくつかのステップが必要です。問題は、ComboBox
の下に入力フィールドがあり、入力がhtmlを表示できないということです。だから最初のステップは、divと入力を置き換えるテンプレートを変更することです。例:
fieldSubTpl: [
'<div class="{hiddenDataCls}" role="presentation"></div>',
'<div id="{id}" type="{type}" ',
'<tpl if="size">size="{size}" </tpl>',
'<tpl if="tabIdx">tabIndex="{tabIdx}" </tpl>',
'class="{fieldCls} {typeCls}" autocomplete="off"></div>',
'<div id="{cmpId}-triggerWrap" class="{triggerWrapCls}" role="presentation">',
'{triggerEl}',
'<div class="{clearCls}" role="presentation"></div>',
'</div>',
{
compiled: true,
disableFormats: true
}
]
次に、選択した値を示したテンプレートに変更します。もう一つは、新しいリスト項目テンプレートを作成することです
displayTpl: Ext.create('Ext.XTemplate', [
'<tpl for=".">',
'<img src="http://phpbb3.pl/adm/images/icon_edit.gif" />',
'{[typeof values === "string" ? values : values["title"]]}',
'</tpl>'
])
を。例:
listConfig: {
getInnerTpl: function() {
return '<div class="search-item">' +
'<h3><img src="http://phpbb3.pl/adm/images/icon_edit.gif" /><span>{[Ext.Date.format(values.lastPost, "M j, Y")]}<br />by {author}</span>{title}</h3>' +
'{excerpt}' +
'</div>';
}
}
最後に、値がdivに正しく設定されていることを確認する必要があります。値がsubmitedされないように、新しいテンプレートは、任意のinput
フィールドが含まれていません
setRawValue: function(value) {
var me = this;
value = Ext.value(value, '');
me.rawValue = value;
// Some Field subclasses may not render an inputEl
if (me.inputEl) {
// me.inputEl.dom.value = value;
// use innerHTML
me.inputEl.dom.innerHTML = value;
}
return value;
}
お知らせ:そのためにあなたはsetRawValue
メソッドをオーバーライドする必要があります。フォームでこのようなコンボを使用する必要がある場合は、fieldSubTpl
のどこかに隠し入力を追加し、その値をsetRawValue
に設定する必要があります。
ワーキングサンプル:displayFieldはHTMLを直接受信しているので、http://jsfiddle.net/lolo/8Xs5h/1/
OMG!、やるべきことのその非常に多く、私はちょうど、私は、サーバーから取得したHTMLを管理することができますどのようにお聞きしたいです、テキストではなく、この場合、より良いアプローチが何であるか教えてください。ありがとう。 –
ありがとう、私はコードを介して自分の道を見つけた:)... –
IE内のスニペット – A1rPun