beforerender method not working

53 views
Skip to first unread message

Saranraj Rasu

unread,
Mar 13, 2017, 10:17:32 AM3/13/17
to jsreport
Hello Team,
      Am new to jsreport studio, Here i used beforerender() method in this method does't working in local machine. I put my code here for your reference.

html code using handlebars.

<table>
    <tr>
    <th>Country</th>
    <th>Name</th>
    <th>abbrivation</th>
    <th>Area</th>
    <th>Largest_city</th>
    <th>capital</th>
    </tr>
   {{#each stats.RestResponse.result}}
   <tr>
       <td>{{country}}</td>
       <td>{{name}}</td>
       <td>{{abbr}}</td>
       <td>{{area}}</td>
       <td>{{largest_city}}</td>
       <td>{{capital}}</td>
   </tr>
   {{/each}}
</table>

script code:

function beforeRender(done) { 
    require('request')({  url:"http://services.groupkt.com/state/get/IND/all",   json:true}, function(err, response, body){
        console.log("check-->",JSON.stringify(body));
        request.template.content = JSON.stringify(body);
        request.data = { stats: body };
        done();
    });
    
}

    Here i used api. this api does not return any data .

Best & Regards.
SARANRAJ K.R

Jan Blaha

unread,
Mar 13, 2017, 10:19:59 AM3/13/17
to jsre...@googlegroups.com
Hi,
please replicate your problem in playground

Jan

Saranraj Rasu

unread,
Mar 13, 2017, 10:21:37 AM3/13/17
to jsreport
thanks for respons

Saranraj Rasu

unread,
Mar 13, 2017, 10:24:59 AM3/13/17
to jsreport


Hi jan,
     In playground where i can put my problem.

by
saran
Reply all
Reply to author
Forward
0 new messages