I tried doing like this:-- In controller--
def get_data(): custdata = db.executesql(qry, as_dict=True) return response.json(custdata) And in View, ....other code is as earlier (hence omitted) "sAjaxSource": "{{=URL('MIS','get_data')}}", Still, the dataTable is blank. Pl. help. ---Vineet On Jun 24, 5:56 pm, Vineet <vineet.deod...@gmail.com> wrote: > As suggested by the community, I am trying to export json data to > dataTable. > But only blank dataTable is rendered (with desired formatting, search > box, etc.) > Pl. introspect into my code as to where I have a mistake. > Data is not displayed (as returned by "get_data" method). > I have made sure that the tables in MySQL have been populated. > > ------------------- > Controller > ------------------- > def show_data(): > return dict() > > def get_data(): > custdata = db.executesql(qry, as_dict=True) > return dict(mydata=custdata) > > # For testing purpose, I returned response.json(custdata) in a > separate method & validated the output on "jsonlint.com". > It is valid json. > But, here the returned value is dict(mydata=custdata). > How do I reference the custdata object in View? > Already tried {{=mydata}} in <script> tag in View > > ------------------- > View (show_data.html) > ------------------- > {{extend 'layout.html'}} > > <script> > $(document).ready(function() { > var oTable = $('.smarttable').dataTable( { > "sScrollY": "200px", > "sAjaxSource": "{{=URL('MIS','get_data.json')}}", > "sDom": "frtiS", > "bDeferRender": true > } );} ); > > </script> > > # html table tags go here > > <h1>Customer Database</h1> > <br /> > <table class="smarttable"> > <thead> > <tr> > <th>Customer Name</th><th>Vehicle No</th>....etc. > </tr> > </thead> > <tbody> > > </tbody> > </table> > > # This link is for testing json data returned. > <a href='{{=URL('MIS','get_rows.json')}}'>my_json</a> > > Thanks, > Vineet > > On Jun 22, 1:51 am, "contatogilson...@gmail.com" > > > > <contatogilson...@gmail.com> wrote: > > It can paginate data? > > _____________________________________________ > > *Gilson Filho* > > *Web Developerhttp://gilsondev.com*- Hide quoted text - > > - Show quoted text -