'Method to get the data for the dataTable
This can be either a raw html representation or
and ajax call update
Additional data will be cached to limit calls back to the server
@param list_fields: list of field names
@param sort_by: list of sort by columns
@param represent: a dict of field callback functions used
to change how the data will be displayed
keyed on the field identifier
@return: a dict()
In html representations this will be a table of the data
plus the sortby instructions
In ajax this will be a json response
In addition the following values will be made available:
recordsTotal         Number of records in the filtered data set
recordsFiltered  Number of records to display
start                Start point in the ordered data set
limit                Number of records in the ordered set
NOTE: limit - recordsFiltered = total cached'

def _dataTable(self, list_fields, sort_by=[[1, 'asc']], represent={}, ajax_item_id=None, dt_bulk_select=[]):

    from s3data import S3DataTable
    request = self.request
    resource = self.resource
    s3 = current.response.s3
    if (s3.filter is not None):
        self.resource.add_filter(s3.filter)
    representation = request.representation
    totalrows = None
    if (representation == 'aadata'):
        (searchq, orderby, left) = resource.datatable_filter(list_fields, request.get_vars)
        if (searchq is not None):
            totalrows = resource.count()
            resource.add_filter(searchq)
    else:
        (orderby, left) = (None, None)
    if (representation == 'aadata'):
        get_vars = request.get_vars
        start = get_vars.get('displayStart', None)
        limit = get_vars.get('pageLength', None)
        draw = int((get_vars.draw or 0))
    else:
        start = 0
        limit = s3.ROWSPERPAGE
    if (limit is not None):
        try:
            start = int(start)
            limit = int(limit)
        except ValueError:
            start = None
            limit = None
    else:
        start = None
    if (not orderby):
        orderby = (~ resource.table.error)
    data = resource.select(list_fields, start=start, limit=limit, count=True, orderby=orderby, left=left)
    rows = data['rows']
    displayrows = data['numrows']
    if (totalrows is None):
        totalrows = displayrows
    _represent = represent.items()
    for row in rows:
        record_id = row['s3_import_item.id']
        for (column, method) in _represent:
            if (column in row):
                row[column] = method(record_id, row[column])
    rfields = resource.resolve_selectors(list_fields)[0]
    dt = S3DataTable(rfields, rows, orderby=orderby)
    datatable_id = 's3import_1'
    if (representation == 'aadata'):
        output = dt.json(totalrows, displayrows, datatable_id, draw, dt_bulk_actions=[current.T('Import')])
    else:
        url = ('/%s/%s/%s/import.aadata?job=%s' % (request.application, request.controller, request.function, ajax_item_id))
        items = dt.html(totalrows, displayrows, datatable_id, dt_ajax_url=url, dt_bulk_actions=[current.T('Import')], dt_bulk_selected=dt_bulk_select)
        output = {'items': items}
        current.response.s3.dataTableID = [datatable_id]
    return output
