jQuery를 사용하여 DustJS 변수가 포함 된 HTML을 추가하고 싶습니다.jquery에서 DustJS 변수를 계산하십시오.
다음$(document).on('ready', function(){
$("tr").click(function(){
$(this).after('<tr class="row-details">\
<td></td>\
<td colspan="4">\
<table class="sortable draggable">\
<thead>\
<tr>\
<th class="col-itemName">Item Name</th>\
<th class="col-quantity">Quantity</th>\
<th class="col-rate">Rate</th>\
<th class="col-amount">Amount</th>\
</tr>\
</thead>\
<tbody>\
{#items}\
<tr>\
<td>{.item.itemName}</td>\
<td>{.quantity}</td>\
<td>{.rate}</td>\
<td>{@math key="{.quantity}" method="multiply" operand="{.rate}"/}</td>\
</tr>\
{/items}\
</tbody>\
</table>\
</td>\
</tr>');
});
});
내 출력됩니다 : 여기에 내가 jQuery를에서 할 노력하고 무엇
가 어떻게 그 변수를 평가합니까 ???
@ 고토 나는 그 페이지에서 아무 것도 이해할 수 없다. 설명하려고 애쓰는거야? – Vishal
jQuery로 HTML을 추가하기 만하면됩니다. 코드에서 먼지를 사용하고 있음을 나타내는 것은 없습니다. jQuery는 먼지 매개 변수를 어떻게 처리해야하는지 알고 있어야합니다. DOM에서 HTML을 렌더링하기 전에 변수를 인쇄하려면 HTML 문자열을'dust.render'에 전달해야합니다. – Simon
@ 시몬 당신은 나에게 모범을 보일 수 있니? – Vishal