javascript - Jsreport shows different result when rendering from client and server -


i have template named , test json stored in server. using normal setup jsreport render pdf work wonder in server.

now want use jsreport_client.js render. ajax call getjson other server , use jsclient render. data not sent/processed correctly. key located near root of json object correct rest not. note same json render on server correctly

edit: below call

$.getjson(ajaxurl).success(function (people) {  jsreport.serverurl = 'http://localhost:5488';  var request = {    template: {       shortid:"rjpuhdmv"    },    data: people   };                                      jsreport.render('_blank', request); }) 

below returned request structure

{   "responseheader":{     "status":0,     "params":{       "fq":"{!frange l=0.80 }query($q)",       "q":"{!percentage}etco~",       "group.field":"ent_id" }},    "grouped":{     "ent_id":{       "ngroups":3,       "groups":[{           "groupvalue":"214493",           "doclist":{"numfound":1,"docs":[               {                  "add_city":"london",                 "add_street":"devonshire street",                 "nam_comp_name":"etco international commodities ltd.",                 "add_country":"gb",                              "add_id":"668638",                 "score":1.0}]           }},other group.....]}}},    "highlighting":{     "c":{       "nam_comp_name":["<span class=\"highlight\">eto</span>"]} }} 

and below handler in server

// can not read parameters  </thead>           {{#each grouped.ent_id.groups}}           </tr>           <td>{{offsetindex @index}}</td>           {{#each doclist.docs}}           <td>{{this.nam_comp_name}}</td>           <td>{{convertscore this.score}}</td>            <td>{{this.add_country}} {{this.add_city}} {{this.add_street}}</td>             <td>{{lis_name}}</td>           {{/each}}                              </tr>            {{/each}} 

another handler has both correct , incorrect/unreadable data

 {{#responseheader.params}}   <tr>     <th>search term</th>     <td>{{sanitizequery this.q}}</td>    // read correctly   </tr>   <tr>     <th>sanction list: </th>     <td>{{sanitizequery this.fq.[0]}}</td> // incorrectly   </tr>   <tr>     <th>countries:</th>     <td>{{sanitizequery this.fq.[1]}}</td> // incorrectly   </tr>    {{/responseheader.params}}     <tr>     <th>search by:</th>     <td>"method of searching"</td> // incorrectly    </tr>     <tr>     <th>found total:</th>     <td>{{grouped.ent_id.ngroups}}</td> // read correctly 

helpers

function offsetindex(index) {     return index+1; }  function convertscore(score) {     = parsefloat(score);     return a*100; } function sanitizequery(query) {     =query         .replace(/{+.*?}+/g, "")         .replace(/\[\[|\]\]/g, "")         .replace(/<.*?>/g, "")         .replace(/add_country:/,"")         .replace(/program_number:/,"")         .replace(/~/,"");     return a; } 

this bug array serialization in jsreport browser client. fixed.

please update jsreport-browser-client-dist@1.0.2 or update whole jsreport can find in jsreport@1.0.9


Comments