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

        # Controller Filter
        if s3.filter is not None:
            self.resource.add_filter(s3.filter)

        representation = request.representation

        # Datatable Filter
        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

        # Start/Limit
        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: # catch all
            start = 0
            limit = s3.ROWSPERPAGE
        if limit is not None:
            try:
                start = int(start)
                limit = int(limit)
            except ValueError:
                start = None
                limit = None # use default
        else:
            start = None # use default

        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 the data
        _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])

        # Build the datatable
        rfields = resource.resolve_selectors(list_fields)[0]
        dt = S3DataTable(rfields, rows, orderby=orderby)
        datatable_id = "s3import_1"
        if representation == "aadata":
            # Ajax callback
            output = dt.json(totalrows,
                             displayrows,
                             datatable_id,
                             draw,
                             dt_bulk_actions = [current.T("Import")])
        else:
            # Initial HTML response
            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

    # -------------------------------------------------------------------------
Testing /contacts/types/add/
dataset/ETHPy150Open sahana/eden/modules/s3/s3import.py/S3Importer._dataTable--crossover with--dataset/ETHPy150Open treeio/treeio/treeio/identities/tests.py/IdentitiesViewsTest.test_contact_type_add_out