'Method to render the data into a json object
@param totalrows: The total rows in the unfiltered query.
@param displayrows: The total rows in the filtered query.
@param id: The id of the table for which this ajax call will
respond to.
@param draw: An unaltered copy of draw sent from the client used
by dataTables as a draw count.
@param flist: The list of fields
@param attr: dictionary of attributes which can be passed in
dt_action_col: The column where the action buttons will be placed
dt_bulk_actions: list of labels for the bulk actions.
dt_bulk_col: The column in which the checkboxes will appear,
by default it will be the column immediately
before the first data item
dt_group_totals: The number of record in each group.
This will be displayed in parenthesis
after the group title.'

def aadata(self, totalrows, displayrows, id, draw, flist, stringify=True, action_col=None, **attr):

    data = self.data
    if (not flist):
        flist = self.colnames
    start = self.start
    end = self.end
    if (action_col is None):
        action_col = attr.get('dt_action_col', 0)
    structure = {}
    aadata = []
    for i in xrange(start, end):
        row = data[i]
        details = []
        for field in flist:
            if (field == 'BULK'):
                details.append(("<INPUT    id='select%s'    type='checkbox'    class='bulkcheckbox'>" % row[flist[action_col]]))
            else:
                details.append(s3_unicode(row[field]))
        aadata.append(details)
    structure['dataTable_id'] = id
    structure['dataTable_filter'] = self.filterString
    structure['dataTable_groupTotals'] = attr.get('dt_group_totals', [])
    structure['dataTable_sort'] = self.orderby
    structure['data'] = aadata
    structure['recordsTotal'] = totalrows
    structure['recordsFiltered'] = displayrows
    structure['draw'] = draw
    if stringify:
        from gluon.serializers import json as jsons
        return jsons(structure)
    else:
        return structure
