【问题标题】:How to use Xtemplate inside sencha architect?如何在 sencha 架构师中使用 Xtemplate?
【发布时间】:2014-11-17 12:27:44
【问题描述】:

我正在使用 sencha touch 开发一个 Web 应用程序,并且我正在使用 sencha 架构师,我想在我的列表 itemtpl 中添加一个条件来查看客户余额的差异:

balance>=0 --> green

balance<0  --> red

这是我的基本项目:

<table width="100%"><tr>
    <td>{c_name}</td>
    <td width="95px">
         <div style="width:95px;height:100%;background:#088cfc;text-align:center;color:#fff;">{balance}</div>
    </td>
    </tr>
</table>

如何使用 sencha architect IDE 添加 xtemplate 并将其链接到我的列表?

谢谢,

【问题讨论】:

    标签: extjs touch


    【解决方案1】:

    老问题,但在处理如何“在 Architect 中使用 XTemplate”时,我想要一个相同问题的答案,这就是标题所指出的,而给出的答案实际上并没有向初学者展示如何做到这一点的答案在我看来,建筑师。

    所以步骤是:

    1. 因此,将您的组件添加到 Architect 画布或您正在使用的任何组件中。
    2. 接下来转到配置列表并找到“进程配置”条目并单击加号

    3. 接下来您将获得一个功能,该功能允许您更新和处理任何当前配置设置或添加您自己的设置。我的函数称为“processMyView”(我在示例中使用了数据视图,因此名称)

    4. 添加一些创建 'tpl' 的 javascript
    5. 确保在函数末尾返回“config”参数

    在我的示例中,我有一个包含标题和所有者的文档列表,因此最终结果将如下所示。

    最终,当您对 Architect 感到沮丧时,这可能是您可以用来解决 IDE 对 Config 设置的僵化的方法之一。

    【讨论】:

      【解决方案2】:

      我实际上在架构师中使用 XTemplate,只是在您的情况下使用 &amp;gt;&amp;lt; 而不是 '':

      if balance>0 ==> 使用:if balance > 0 见下文:

      <table width="100%"><tr>
          <td>{c_name}</td>
          <td width="95px">
              <tpl if="balance &gt; 0"> 
               <div style="border-radius:5px;;width:95px;height:100%;background:#088cfc;text-align:center;color:#fff;font-size:12px;height:23px;padding-top:4px;">{balance} ₪</div>
              </tpl> 
              <tpl if="balance &lt; 0"> 
               <div style="border-radius:5px;;width:95px;height:100%;background:#f00;text-align:center;color:#fff;font-size:12px;height:23px;padding-top:4px;">{balance} ₪</div>
              </tpl> 
          </td>
          </tr>
      </table>
      

      【讨论】:

      • 就是答案,只要用''的ascii码我就放这里用空格'& g t;'和'& l t;'
      猜你喜欢
      • 1970-01-01
      • 2014-04-07
      • 1970-01-01
      • 2012-10-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多