What happens if you go to /MyWheels/MIS/get_data? Do you get the proper JSON 
returned? If so, then the problem is probably in your client-side JS code. 
Also, on the client side, check in Firebug (or similar) to see if the Ajax 
call is getting made properly, and if it is returning the JSON. You may need 
to work on debugging the client-side JS/DataTables code.
 
Anthony

On Saturday, June 25, 2011 10:57:23 PM UTC-4, Vineet wrote:

> a='MyWheels', c='MIS', f='get_data'. 
> So, {{=URL('MIS','get_data')}} should work. 
> But I do not get the data in dataTable. 
> ---Vineet 
>
> On Jun 25, 11:13 pm, Anthony <abas...@gmail.com> wrote: 
> > Is MIS your app name, or the controller name? If it's the app name, your 
> URL 
> > call also needs the controller name, or it will think MIS is the 
> controller 
> > and the Ajax call will fail. 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Saturday, June 25, 2011 1:02:50 PM UTC-4, Vineet wrote: 
> > > 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 <vinee...@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, "conta...@gmail.com" 
> > 
> > > > <conta...@gmail.com> wrote: 
> > > > > It can paginate data? 
> > > > > _____________________________________________ 
> > > > > *Gilson Filho* 
> > > > > *Web Developerhttp://gilsondev.com*-Hide quoted text - 
> > 
> > > > - Show quoted text -

Reply via email to