json 응답을 기반으로 테이블을 작성해야합니다. API를 호출 할 때 API를 호출하고 JSON이 올바르게 작동하도록 설정하면 테이블을 만드는 방법에 대한 문서가 없습니다. x.js에서 x.html로 전달합니다. 나는 json에서 단지 1 개의 param/value를 전달하는 데 성공한다.html 테이블에 json 데이터 피드
내 JSON은 다음과 같습니다 (그것은 젠킨스의 API 결과입니다)
{
"builds":
[
{
"duration": 24503,
"id": "2013-12-11_19-48-55",
"number": 33,
"result": "FAILURE",
"timestamp": 1386791335164
},
{
"duration": 24553,
"id": "2013-12-11_19-00-27",
"number": 32,
"result": "FAILURE",
"timestamp": 1386788427803
},
{
"duration": 24237,
"id": "2013-12-11_18-59-51",
"number": 31,
"result": "FAILURE",
"timestamp": 1386788391179
},
JS 코드
Meteor.call('jenkinsServiceBuild', function(err, respJson) {
if(err) {
window.alert("Error: " + err.reason);
console.log("error occured on receiving data on server. ", err);
} else {
//window.alert("Success: ");
console.log("respJson: ", respJson.builds[1].id);
//window.alert(respJson.length + ' tweets received.');
var buildsList = respJson.builds[1].id;
Session.set("recentBuilds", respJson.builds[1].id);
}
$('#buildButton').removeAttr('disabled').val('build');
})
},
});
Template.dashboard.helpers({
recentBuilds : function() {
return Session.get("recentBuilds");
//recentBuilds: buildsList
} });
HTML 코드
<template name="dashboard">
<div class="control-group">
<div class="controls">
<input type="button" value="build" class="btn btn-info" id="buildButton"/>
</div>
<br><br>
___{{recentBuilds}}___
</template>
감사 Ronen에
나는 YUI에서 시일을 추정 클래스를 사용하는 것이 좋습니다하거나 작업을 매우 것 부트 스트랩 것이다 쉬운 – AMY