'Extract the rows from the resource
@param resource: the resource
@param list_fields: fields to include in list views'

def extract(self, resource, list_fields):

    title = self.crud_string(resource.tablename, 'title_list')
    get_vars = dict(current.request.vars)
    get_vars['iColumns'] = len(list_fields)
    (query, orderby, left) = resource.datatable_filter(list_fields, get_vars)
    resource.add_filter(query)
    if (orderby is None):
        orderby = resource.get_config('orderby')
    data = resource.select(list_fields, left=left, limit=None, count=True, getids=True, orderby=orderby, represent=True, show_links=False)
    rfields = data.rfields
    rows = data.rows
    types = []
    lfields = []
    heading = {}
    for rfield in rfields:
        if rfield.show:
            lfields.append(rfield.colname)
            heading[rfield.colname] = (rfield.label or rfield.field.name.capitalize().replace('_', '    '))
            if (rfield.ftype == 'virtual'):
                types.append('string')
            else:
                types.append(rfield.ftype)
    return (title, types, lfields, heading, rows)
