2012-04-23 3 views
1

jtemplate에서 로컬 변수 또는 for 루프 (foreach 대신)를 만들 수 있습니까? HTML 요소에 고유 한 ID를 부여하고 카운터 나 다른 것이 필요합니다. 감사!jTemplates의 로컬 변수/for 루프

답변

4

사용 $index

$index - index of the element in the table 
$iteration - ID of the iteration (the next number begins from 0) 
$first - is this the first iteration? 
$last - is this the last iteration? 
$total - the total number of iterations 

{#foreach $T.Rows as row} 
    $T.row$index 
{#/for} 

http://www.codeproject.com/Articles/45759/jQuery-jTemplates-Grid

+0

이 prefectly 근무 읽어 보시기 바랍니다. 고마워요! – tempid