所以我使用tal:repeat語句在另一個表內生成表。 可悲的是,我不知道如何在生成時爲每個表提供唯一的ID。我怎樣才能做到這一點?給每個表使用zpt的新ID使用zpt
我試圖使用方法:
tal:attributes="id myindex"
和
tal:attributes="id string:${myindex}"
但我無法得到它的工作。
實施例:
<table id="tableIngrepen" class="table">
<thead class="header">
<tr>
<th>Header1</th>
<th tal:repeat="procedur_headers Procedur_Headers" tal:content="procedur_headers" > </th>
</tr>
</thead>
<tr tal:repeat="diagnoses Diagnoses">
<div tal:define="myindex python:repeat['diagnoses'].index">
<td ><input type='text' id="dz_code" readonly></input></td> <!-- onfocus="rijencolom($(this).parent().children().index($(this)),$(this).parent().parent().children().index($(this).parent()))" -->
<td colspan="5">
<table tal:attributes="id myindex" class="table table-hover" style="border-style:none">
<thead class="header">
<tr>
<th tal:repeat="procedur_headers Procedur_Headers" tal:content="procedur_headers" style="display:none"> </th> <!-- style="display:none"-->
</tr>
</thead>
<tr tal:repeat="list_procedur List_Procedur[myindex]">
<td><input type='text' ></input></td>
</tr>
<tr>
<td><input type='text' ></input></td>
<td ><input type='text'></input></td>
<td><input type='text' ></input></td>
<td><input type='text' ></input></td>
</tr>
</table>
</td>
</div>
</tr>
是的語法好嗎?它不是'table - $ {repeat/myindex/index}'? – 2013-05-10 16:03:21
@keul:啊,是的。這是變色龍用於* Plone *;默認變色龍使用Python表達式,但Plone集成切換到路徑表達式。 – 2013-05-10 16:04:04
所以我想我畢竟走在了正確的軌道上,感謝這種消除,這超出了我的期望。然而,我認爲我使用默認的變色龍zpt,因爲當我使用代碼時,我提供了以下錯誤:TypeError:不支持的操作數類型爲/:'RepeatDict'和'callableint'==>表達式:「string :表 - $ {重複/ myindex /指數}」。 – GertV 2013-05-10 16:17:37