Yes. As a side note, DABO is written fully in Python itself. It is a full fledged framework using wxPython for GUI. But I am using its database-interaction tier & business-logic tier (dabo.biz & dabo.db).
Since we, web2py followers, are using "web2py" as a footing, you may ignore the code regarding "ui" in the below-referred links. http://thewinecellarbook.com/daboDocTestAlt/dabo.biz_module.html#dabo... http://thewinecellarbook.com/daboDocTestAlt/dabo.db_module.html#dabo-db http://thewinecellarbook.com/daboDocTestAlt/ http://www.dabodev.com -- Vineet On Feb 13, 8:16 pm, Richard Vézina <ml.richard.vez...@gmail.com> wrote: > Hi Vineet, > > Thanks for sharing. So, if I understand correctly, you use DABO code as an > equivalent of the php code in the example from the DTs to allow grid to > interact with database... > > I will have a look at PowerTable this week to see if it actually implement > server processing and if not to try to figure out how we could add the > feature... > > :) > > Richard > > > > > > > > On Sat, Feb 11, 2012 at 1:08 AM, Vineet <vineet.deod...@gmail.com> wrote: > > Richard, > > Here is my minimal code for returning json data in dataTables via > > web2py's ajax function. > > > ---View--- > > <!-- here's a well-formed table --> > > <table id="abc_table"> > > <thead> > > <tr> > > <th>ABC Category Name</th> > > <th>Code</th> > > </tr> > > </thead> > > <tbody> > > </tbody> > > </table> > > > <script> > > // this I keep in js folder > > > function dtbl_show(hash_div, sAjaxSource, aoColumns) { > > > $(document).ready(function() { > > > $(hash_div).dataTable( { > > > "bJQueryUI": true, > > > "bDeferRender": true, > > > "bPaginate": true, > > > 'sPaginationType': 'full_numbers', > > > "bProcessing": true, > > > "bServerSide": true, > > > "aaSorting": [[ 1, "desc" ]], > > > "bAutoWidth": false, > > > "aoColumns" : aoColumns, > > > "sAjaxSource": sAjaxSource > > > } ); > > > } ); > > > jQuery.fn.dataTableExt.oPagination.iFullNumbersShowPages = > > 10; > > > } > > </script> > > > <script> > > // call here this script & pass the table's div for rendering it > > > dtbl_show("#abc_table", "{{=URL('abc','get_abcdata')}}", [{ sWidth: > > '350px' }, { sWidth: '200px' }] ) > > </script> > > > --- End View --- > > > --- Controller for populating data via ajax --- > > (excuse the bugged-up indentation here) > > > def get_abcdata(): > > if request_vars_iDisplayStart != None: > > > iDisplayStart = request_vars_iDisplayStart > > > else: > > > iDisplayStart = 0 > > > if request_vars_iDisplayLength != None: > > > iDisplayLength = request_vars_iDisplayLength > > > else: > > > iDisplayLength = 10 > > > if request_vars_sEcho != None: > > > sEcho = int(request_vars_sEcho) > > > else: > > > sEcho = 1 > > > qry = 'your sql query string' > > > ### Below this, I am using a 3rd party library viz. DABO for > > interacting with DB. > > ### You may substitute that syntax with the DB layer of your choice > > (DAL or whatever else) and get dataset. > > > try: > > > conn_name = connInstance.makeConn() > > > cur = conn_name.cursor() > > > qry = qry1 + ' limit ' + str(iDisplayStart) + ', ' + > > str(iDisplayLength) + ';' > > > # fetch total data > > > cur.execute(qry1) > > > data_full = cur.getDataSet() > > > iTotalRecords = len(data_full) > > > # fetch data as requested from client > > > cur.execute(qry) > > > data_disp = cur.getDataSet() > > > iTotalDisplayRecords = len(data_full) > > > finally: > > > conn_name.close() > > > aaData = [] > > # Now populate the aaData with data in form of lists. > > # e.g. aaDada will look like -- [[1, 'Vineet'],[2,'Richard']] > > # This formatting is important > > > D=dict(sEcho=sEcho, iTotalRecords=iTotalRecords, > > iTotalDisplayRecords=iTotalDisplayRecords, > > iDisplayLength=iDisplayLength, aaData=aaData) > > return response.json(D) > > > -- End of Controller code -- > > > That's wraps it up. > > If you need any further drilling down in my code, pl. ask. > > I will be happy to share. > > > HTH, > > --- Vineet > > > On Feb 8, 10:18 pm, Richard Vézina <ml.richard.vez...@gmail.com> > > wrote: > > > Yes! > > > > I think the PowerTable of Burno don't implement server side processing > > > yet... We maybe can start form there to make a server side implementation > > > of PowerTable... What do you think? > > > > I think, we have to split table header from data then wrote a python > > > implementation fo the php script as shown in the example of DTs... > > > > For sure see a bit of your code could help me figure out the path I > > should > > > follow and help my reflexion. > > > > About "fnInitComplete" it is just needed in case you want to initialise > > DTs > > > with fixed columns... > > > > Richard > > > > On Wed, Feb 8, 2012 at 11:52 AM, Vineet <vineet.deod...@gmail.com> > > wrote: > > > > Hi Richard ! > > > > Pl. excuse my late replying. > > > > Glad to hear that you got it working. > > > > > If you are interested, I can share my code. > > > > I am not using "fnInitComplete". > > > > Mine is very simple & minimal code. > > > > > --- Vineet > > > > > On Feb 7, 10:19 pm, Richard Vézina <ml.richard.vez...@gmail.com> > > > > wrote: > > > > > Finally got it to work... > > > > > > There was a problem with the init of DTs particularly this option : > > >http://datatables.net/release-datatables/extras/FixedColumns/server-s... > > > > > > *fnInitComplete* > > > > > * > > > > > * > > > > > * > > > > > * > > > > > It's not solving my speed problem as I expect it could do... So I > > will > > > > put > > > > > it on hold, but I plan to implement a basic server interaction > > script as > > > > > the php DTs example to make it easier deploy DTs with server side > > > > > capability... > > > > > > Richard > > > > > > On Mon, Feb 6, 2012 at 6:10 PM, Bruno Rocha <rochacbr...@gmail.com> > > > > wrote: > > > > > > Not, > > > > > > > PowerGrid is based in pure Jquery Templates > > > > > > > -- > > > > > > > Bruno Rocha > > > > > > [http://rochacbruno.com.br]