The response for index action, which can be a pagination of a
 record collection or a grouped count of attributes
5520
def index_json
      if params[:group].present?
        @records.group(params[:group][:by].split(','))
                .send(:calculate,
                      params[:group][:calculate],
                      params[:group][:field])
      else
        collection_response
      end
    end
79575
def _index_item(self, uri, num, batch_num):
        

        data = RdfDataset(get_all_item_data(uri, self.namespace),
                          uri).base_class.es_json()
        self.batch_data[batch_num].append(data)
        self.count += 1
549320
def list_with_post(self, request):
        """"""
        if self.is_search_request():
            search = self.search()

            page = self.paginate_queryset(search)
            if page is None:
                items = search
            else:
                items = page

            try:
                primary_keys = []
                order_map_cases = []
                for order, item in enumerate(items):
                    pk = item[self.primary_key_field]
                    primary_keys.append(pk)
                    order_map_cases.append(When(pk=pk, then=Value(order)))

                queryset = self.get_queryset().filter(
                    pk__in=primary_keys
                ).order_by(
                    Case(*order_map_cases, output_field=IntegerField()).asc()
                )
            except KeyError:
                raise KeyError("Combined viewset requires that your index contains a field with "
                               "the primary key. By default this field is called 'id', but you "
                               "can change it by setting primary_key_field.")

            # Pagination must be handled differently.
            serializer = self.get_serializer(queryset, many=True)
            if page is not None:
                return self.get_paginated_response(serializer.data)

            return Response(serializer.data)
        else:
            queryset = self.filter_queryset(self.get_queryset())
            return self.paginate_response(queryset)
913582
def core__widgets_index(records, search: nil, pagination: 50)
      response = {
        records: records,
        total: records.length,
        per_page: pagination,
        search: '',
        search_key: search,
        sort: '',
        sort_dir: 'ASC',
        pagination: 1,
      }

      # manage search
      if search && params[:widget_index] && params[:widget_index][:search] && !params[:widget_index][:search].blank?
        search_array = search.is_a?(Array) ? search : [search]
        query1 = ''
        query2 = []
        search_array.each do |s|
          query1 += "#{s} like ? OR "
          query2.push("%#{params[:widget_index][:search]}%")
        end
        query1 = query1[0...-4]
        query = [query1] + query2
        response[:records] = response[:records].where(query)
        response[:total] = response[:records].length
        response[:search] = params[:widget_index][:search]
      end
      # manage sort
      if params[:widget_index] && !params[:widget_index][:sort].blank? && !params[:widget_index][:sort_dir].blank?
        response[:sort] = params[:widget_index][:sort]
        response[:sort_dir] = params[:widget_index][:sort_dir]
        response[:records] = response[:records].order("#{params[:widget_index][:sort]} #{params[:widget_index][:sort_dir]}")
      end
      # manage pagination
      if pagination
        if params[:widget_index] && params[:widget_index][:pagination]
          response[:pagination] = params[:widget_index][:pagination].to_i
        end
        response[:records] = core__paginate_array(response[:records], pagination, response[:pagination])
      end
      # return response
      response
    end
1009895
def index(self, request):
        """"""
        objects = self.model.objects.all()

        return self._render(
            request = request,
            template = 'index',
            context = {
                cc2us(pluralize(self.model.__name__)): objects,
            },
            status = 200
        )
1326082
def response_action(self, request, queryset):  # noqa
        
        # There can be multiple action forms on the page (at the top
        # and bottom of the change list, for example). Get the action
        # whose button was pushed.
        try:
            action_index = int(request.POST.get('index', 0))
        except ValueError:  # pragma: no cover
            action_index = 0

        # Construct the action form.
        data = request.POST.copy()
        data.pop(helpers.ACTION_CHECKBOX_NAME, None)
        data.pop("index", None)

        # Use the action whose button was pushed
        try:
            data.update({'action': data.getlist('action')[action_index]})
        except IndexError:  # pragma: no cover
            # If we didn't get an action from the chosen form that's invalid
            # POST data, so by deleting action it'll fail the validation check
            # below. So no need to do anything here
            pass

        action_form = self.action_form(data, auto_id=None)
        action_form.fields['action'].choices = self.get_action_choices(request)

        # If the form's valid we can handle the action.
        if action_form.is_valid():
            action = action_form.cleaned_data['action']
            func, name, description = self.get_actions(request)[action]

            # Get the list of selected PKs. If nothing's selected, we can't
            # perform an action on it, so bail.
            if action_form.cleaned_data['select_across']:
                selected = ALL
            else:
                selected = request.POST.getlist(helpers.ACTION_CHECKBOX_NAME)

            if not selected:
                return None

            revision_field = self.model._concurrencymeta.field

            if self.check_concurrent_action:
                self.delete_selected_confirmation_template = self.get_confirmation_template()

                # If select_across we have to avoid the use of concurrency
                if selected is not ALL:
                    filters = []
                    for x in selected:
                        try:
                            pk, version = x.split(",")
                        except ValueError:  # pragma: no cover
                            raise ImproperlyConfigured('`ConcurrencyActionMixin` error.'
                                                       'A tuple with `primary_key, version_number` '
                                                       'expected:  `%s` found' % x)
                        filters.append(Q(**{'pk': pk,
                                            revision_field.attname: version}))

                    queryset = queryset.filter(reduce(operator.or_, filters))
                    if len(selected) != queryset.count():
                        messages.error(request, 'One or more record were updated. '
                                                '(Probably by other user) '
                                                'The execution was aborted.')
                        return HttpResponseRedirect(".")
                else:
                    messages.warning(request, 'Selecting all records, you will avoid the concurrency check')

            response = func(self, request, queryset)

            # Actions may return an HttpResponse, which will be used as the
            # response from the POST. If not, we'll be a good little HTTP
            # citizen and redirect back to the changelist page.
            if isinstance(response, HttpResponse):
                return response
            else:
                return HttpResponseRedirect(".")
345340
def _wrap_paginated_response(cls, request, response, controls, data,
                                 head=None):
        
        paging_response = response['paging']
        if head is None:
            head = response['head_id']
        link = cls._build_url(
            request,
            head=head,
            start=paging_response['start'],
            limit=paging_response['limit'])

        paging = {}
        limit = controls.get('limit')
        start = controls.get("start")
        paging["limit"] = limit
        paging["start"] = start
        # If there are no resources, there should be nothing else in paging
        if paging_response.get("next") == "":
            return cls._wrap_response(
                request,
                data=data,
                metadata={
                    'head': head,
                    'link': link,
                    'paging': paging
                })

        next_id = paging_response['next']
        paging['next_position'] = next_id

        # Builds paging urls specific to this response
        def build_pg_url(start=None):
            return cls._build_url(request, head=head, limit=limit, start=start)

        paging['next'] = build_pg_url(paging_response['next'])

        return cls._wrap_response(
            request,
            data=data,
            metadata={
                'head': head,
                'link': link,
                'paging': paging
            })
736209
def resource_collection_response(cls, offset=0, limit=20):
        
        request_args = {'page[offset]': offset, 'page[limit]': limit}
        return cls.get_collection(request_args)
591659
function getSearchableIndexFormAttrs(isindexStartTagToken) {
    var indexAction = Tokenizer.getTokenAttr(isindexStartTagToken, ATTRS.ACTION),
        attrs = [];

    if (indexAction !== null) {
        attrs.push({
            name: ATTRS.ACTION,
            value: indexAction
        });
    }

    return attrs;
}
280898
def apply_pagination(self, q):
        
        # type: (Query)->Query
        assert self.record_count >= 0, "Record count must be set."
        return q.limit(self.page_size).offset(self.offset)
1121659
def recordSet( self ):
        
        if ( not self.table() ):
            return None
        
        recordSet = RecordSet(self.table())
        recordSet.setQuery(self.query())
        
        # set the grouping options
        grouping = nativestring(self.uiGroupingTXT.text()).split(',')
        while ( '' in grouping ):
            grouping.remove('')
        
        recordSet.setGroupBy( grouping )
        
        # set the sorting options
        sorting = nativestring(self.uiSortingTXT.text()).split(',')
        while ( '' in sorting ):
            sorting.remove('')
        
        recordSet.setOrder([i.split('|') for i in sorting])
        
        # set the paged options
        recordSet.setPaged(self.uiPagedCHK.isChecked())
        recordSet.setPageSize(self.uiPagedSPN.value())
        
        return recordSet
680898
def index
      # Index mode
      @sub_tenants = MnoEnterprise::SubTenant
      @sub_tenants = @sub_tenants.limit(params[:limit]) if params[:limit]
      @sub_tenants = @sub_tenants.skip(params[:offset]) if params[:offset]
      @sub_tenants = @sub_tenants.order_by(params[:order_by]) if params[:order_by]
      @sub_tenants = @sub_tenants.where(params[:where]) if params[:where]
      @sub_tenants = @sub_tenants.all
      response.headers['X-Total-Count'] = @sub_tenants.metadata[:pagination][:count]
    end
547438
def show
      @record = user_scoped.find(params[:id])
     #add_topic_path
      respond_to do |format|
        format.html {
          prepare_list
          @search = page_info.record
          render :action=>'index'
        }
        format.js
      end
    end
240852
def create_indexed_document(index_instance, model_items, action):
    '''
    
    '''
    data = []
    if action == 'delete':
        for pk in model_items:
            data.append({'_id': pk, '_op_type': action})
    else:
        for doc in model_items:
            if index_instance.matches_indexing_condition(doc):
                data.append(index_instance.serialize_object(doc))
    return data
174842
public function indexAction()
    {
        $pageName = $this->getEvent()
            ->getRouteMatch()
            ->getParam('page', 'index');

        $pageType = $this->getEvent()
            ->getRouteMatch()
            ->getParam('pageType', PageTypes::NORMAL);

        $pageRevisionId = $this->getEvent()
            ->getRouteMatch()
            ->getParam('revision', null);

        return $this->getCmsResponse(
            $this->currentSite,
            $pageName,
            $pageType,
            $pageRevisionId
        );
    }
210553
def paginate_queryset(self, queryset, request, view=None):
        
        result = super(MultipleModelLimitOffsetPagination, self).paginate_queryset(queryset, request, view)

        try:
            if self.max_count < self.count:
                self.max_count = self.count
        except AttributeError:
            self.max_count = self.count

        try:
            self.total += self.count
        except AttributeError:
            self.total = self.count

        return result
307662
public function index()
    {
        /** @var \Colibri\Database\ModelCollection $items */
        $items = new $this->listClass();
        $this->applyListFilters($items);
        $items->load();

        $this->template->vars[$this->listTplVar] = $items;
        if ($this->pagedList) {
            $this->template->vars['pagination'] = [
                'page'           => (int)(isset($_GET['page']) ? $_GET['page'] : 0),
                'recordsPerPage' => $items->recordsPerPage,
                'recordsCount'   => $items->recordsCount,
                'pagesCount'     => $items->pagesCount,
                'base_url'       => '/' . $this->division . '/' . $this->module,
            ];
        }
    }