DojoコンボボックスのドロップダウンにJSONの値を入力しています。以下のコードは問題なく機能します(インラインJSON)....。
<script>
var magicvars = {
identifier: 'name',
label: 'name',
items: [
{name: "ZCCN_NO_1", label: "<img width='16px' height='16px' src='http://localhost:3000/static/images/eight_ball_16x16.png'/>ACCN_NO_1"},
{name: "CR_Local_ID", label:"<img width='16px' height='16px' src='http://localhost:3000/static/images/eight_ball_16x16.png'/>CR_Local_ID"}
]};
</script>
<div dojoType="dojo.data.ItemFileReadStore" data="magicvars" jsId="xvarStore2"></div>
ただし、JSONの外部ファイルを指定すると、ドロップダウンが表示されます。外部ファイルはstandard.txtで、次のようになります...
{
identifier: 'name',
label: 'name',
items: [
{name: "ZCCN_NO_1", label: "<img width='16px' height='16px' src='http://localhost:3000/static/images/eight_ball_16x16.png'/>ACCN_NO_1"},
{name: "CR_Local_ID", label:"<img width='16px' height='16px' src='http://localhost:3000/static/images/eight_ball_16x16.png'/>CR_Local_ID"}
]};
dojoへの私のHTML呼び出しは次のようになります。
<div dojoType="dojo.data.ItemFileReadStore" jsId="xvarStore2" url="http://localhost:3000/static/standard.txt">
</div>
インラインは正常に機能しますが、外部呼び出しは機能しません。これが修正の質問である場合はお詫びしますが、外部ファイルを読み取って「magicvars」に割り当てるにはどうすればよいですか。インラインJSONの束でHTMLを乱雑にしたくありません。
アドバイスをいただければ幸いです。ジャニー