Overwrite AR::Relation#load to actually load one more record to judge if the page has next page
 then store the result in @_has_next ivar
328062
def load
      if loaded? || limit_value.nil?
        super
      else
        @values[:limit] = limit_value + 1
        # FIXME: this could be removed when we're dropping AR 4 support
        @arel.limit = @values[:limit] if @arel && (Integer === @arel.limit)
        super
        @values[:limit] = limit_value - 1
        # FIXME: this could be removed when we're dropping AR 4 support
        @arel.limit = @values[:limit] if @arel && (Integer === @arel.limit)

        if @records.any?
          @records = @records.dup if (frozen = @records.frozen?)
          @_has_next = !!@records.delete_at(limit_value)
          @records.freeze if frozen
        end

        self
      end
    end
561922
private function loadByData(): Record
    {
        $this->_loaded = true;
        $this->_data = $this->_table->row('*', self::dataForWrite())->toArray();
        return $this;
    }
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
1121650
def load_stored_page
      if Volt.client?
        if `sessionStorage`
          page = Volt.current_app.page
          page_obj_str = nil

          `page_obj_str = sessionStorage.getItem('___page');`
          `if (page_obj_str) {`
          `sessionStorage.removeItem('___page');`

          EJSON.parse(page_obj_str).each_pair do |key, value|
            page.send(:"_#{key}=", value)
          end
          `}`
        end
      end
    rescue => e
      Volt.logger.error("Unable to restore: #{e.inspect}")
    end
660382
def check_page_availability!(type)
      return unless @attributes[type.to_sym].nil?

      raise(
        type.eql?(:next) ?
          UserEngage::NoNextPageAvailableException :
          UserEngage::NoPreviousPageAvailableException,
        "No #{type} page available"
      )
    end
70634
def eachRecord( records = @records )
      if records and block_given?
         records.each { |record|
            if record.is_a?( REXML::Element) and record.name == "record"
               @record = record
               yield record
            end
         }
      end
      nil
   end
641070
public function next()
	{
		$pageSize=$this->_dataProvider->getPagination()->getPageSize();
		$this->_currentIndex++;
		if($this->_currentIndex >= $pageSize)
		{
			$this->_currentPage++;
			$this->_currentIndex=0;
			$this->loadPage();
		}
	}
1025107
def will_paginate(collection_or_options = nil, options = {})
      if collection_or_options.is_a? Hash
        options, collection_or_options = collection_or_options, nil
      end
      unless options[:renderer]
        options = options.merge :renderer => MaterializePagination::Rails
      end
      super *[collection_or_options, options].compact
    end
1074267
def next_page(params = {}, opts = {})
      return self.class.empty_list(opts) unless has_more
      last_id = data.last.id

      params = filters.merge(starting_after: last_id).merge(params)

      list(params, opts)
    end
765290
def page(page_number)
      request = page_iterator.get_page(page_number)
      self.instance_eval { @env = request.env } if request
      request
    end
1105512
function executeRelatedResultWithQuery (result, relatedName) {
    // get custom args for related model query
    var relatedArgs = this.args.with[relatedName]
    // get relation
    var relation = this.model.relation(relatedName)
    // build query args
    var queryArgs = {
        all: true,
        allow: this.args.allow,
        session: this.session,
        where: { relation: { name: this.model.name } },
    }
    // relation is via a linking table
    if (relation.via) {
        queryArgs.where.relation[relation.viaModelIdColumn] = result[relation.modelIdColumn] || result[model.defaultColumns[relation.modelIdColumn]]
    }
    // relation is direct
    else {
        queryArgs.where.relation[relation.relationIdColumn] = result[relation.modelIdColumn] || result[model.defaultColumns[relation.modelIdColumn]]
    }
    // merge args
    if (typeof relatedArgs === 'object') {
        _.merge(queryArgs, relatedArgs)
    }
    // do query on related model
    return relation.model.query(queryArgs)
    // merge related records once loaded
    .then(results => {
        result._related[relatedName] = results
    })
}
414758
def collection
      get_collection_ivar || begin
        chain = end_of_association_chain

        # scopes
        chain = apply_scopes(chain)

        # search
        if params[:search]
          chain = chain.search(params[:search].to_s.downcase, match: :all)
        end

        # pagination
        if params[:page]
          per_page = params[:perPage] || 20
          chain    = chain.page(params[:page]).per(per_page)
        else
          chain = chain.all
        end

        set_collection_ivar(chain)
      end
    end
576489
def __has_next_page(self, current_page_num=0):
        
        try:
            next_page = self.robot.get_elements(
                self.base.get('next_page'),
                multiple=True
            )
            log.debug('<Site> has {} next page elems'.format(len(next_page)))
            if not next_page:
                return False
            for i, ele in enumerate(next_page):
                if ele.get_attribute('innerText') == 'Next':
                    log.debug('<Site> {} is the right link'.format(i))
                    self.next_page = ele
                    break
            return True
        except Exception as _:
            self.next_page = None
            return False
751883
async function loadRecord (controller, args, defaultQueryArgs) {
    // if no id is passed throw 404 immediately
    if (!args.id) {
        httpError(404)
    }
    // get model from controller
    var model = controller.model
    // build query args
    var queryArgs = {
        limit: 1,
        session: args.session,
        where: {id: args.id},
    }
    // if query args are passed use them
    if (defined(defaultQueryArgs)) {
        _.merge(queryArgs, defaultQueryArgs)
    }
    // add current flag if set
    if (args.current) {
        queryArgs.current = true
    }
    // query both deleted and not deleted instances if deleted option set
    if (args.deleted) {
        queryArgs.where.isDeleted = null
    }
    // load record
    var record = await model.query(queryArgs)
    // throw 404 if not found
    if (!record) {
        httpError(404)
    }
    // create new object that will be merged into args
    var merge = {}
    // add record to args keyed by model name
    merge[model.name] = record
    // return data to merge into args
    return merge
}
459035
def view_aterator(connection, callback, view, view_keys=dict(),
                  args=tuple(), kwargs=dict(), per_page=15,
                  consume_errors=True):
    '''
    
    '''
    skip = 0
    while True:
        keys = dict(view_keys)
        keys.update(dict(skip=skip, limit=per_page))
        records = yield connection.query_view(view, **keys)
        log.debug('view_aterator', "Fetched %d records of the view: %s",
                  len(records), view.name)
        skip += len(records)
        for record in records:
            try:
                yield callback(connection, record, *args, **kwargs)
            except Exception as e:
                error.handle_exception(
                    'view_aterator', e,
                    "Callback %s failed its iteration on a row %r",
                    callback.__name__, record)
                if not consume_errors:
                    raise e

        if not records:
            break
394304
def reload
      if new_record?
        false
      else
        reloaded_element = self.class.find(self.id)
        @attributes = reloaded_element.attributes
        reset_modifications
        true
      end
    end
992206
def scope
      if tree.columns.scope?
        tree.base_class.where Hash[tree.columns.scope.map { |column| [column, record[column]] }]
      else
        tree.base_class.where(nil)
      end
    end