1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

XTemplateのxindexの使い方

Posted at

xindexの使い方でよく迷うのでメモ

ifのなかで使う場合は括弧なしでそのままxindexと記載し、
HTMLの穴埋めに使う場合は{[xindex]}と記載する

記載

Template.js
Ext.define('sencha.view.main.Template', {
    extend: 'Ext.Component',
    xtype: 'comptep',
    renderData: {
        abc: [{hoge:'aaaa'},{hoge:'bbbb'}]
    },
    renderTpl: new Ext.XTemplate(
        '<div>',
        '<tpl for="abc">',
        '<tpl if="xindex == 1">',
        '<p>{[xindex]}{hoge}</p>',
        '</tpl>',
        '</tpl>',
        '</div>'
    )
});

##結果

image.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?