分享我的解決方案,這將可幫助他人:)...
經過谷歌搜索,並從Sightly/HTL Documentation我才知道,通過收集悅目/ HTL迭代只。
所以我用「HTL JavaScript Use-API」來實現我的問題解決方案。
首先在我的.js文件中,得到對話框的整數值後,我返回一個基於該值的數組。 以下是我的「itemCount.js」文件的代碼:使用即時遍歷數組悅目列表(數據狡猾列表)
"use strict";
use(function() {
var count = properties["loopCountValue"];
return new Array(Number(count));
});
其次在我的.html文件。 以下是我的 「testCount.html」 文件的代碼:
<sly data-sly-use.clientLib="${'/libs/granite/sightly/templates/clientlib.html'}" />
<sly data-sly-use.itemCount="itemCount.js" data-sly-unwrap />
<sly data-sly-test="${!itemCount}">
<div>
<h2>Iterate a sightly loop based on Integer value passed from dialog.</h2>
</div>
</sly>
<sly data-sly-test="${itemCount}">
<p>Test Count ${itemCount}</p>
<ul data-sly-list.contentCount="${colCount}">
<li>ITEMS : ${contentCountList.count}</li>
</ul>
</sly>
-
感謝,
Arpit寶來
感謝@Vlad的建議,這是非常有幫助:) – ArpitBora