Search all record in view

(function () {
  'use strict';
  // Replace with your Custom View's view ID
  var customViewID = 6387076;

  var vm = new Vue({
    data: {
      searchText: '', // Add a section for search text to the data object
      records: [],
    },
    computed: {
      // Create a function to filter
      filteredRecords: function () {
        var self = this;
        return self.records.filter(function (record) {
          return record.employeename.value.indexOf(self.searchText) !== -1;
        });
      }
    },
  });

  kintone.events.on('app.record.index.show', function (event) {
    if (event.viewId !== customViewID) return event;
    var records = event.records;

    // Mount the Vue instance on the HTML element with ID #app in the custom view
    vm.$mount('#app');

    // Set the data

    Vue.set(vm, 'records', records);
    return event;
  });
})();

I find this search form in a custom view with vue.js but the problem is it only search all the data within the pagination it won’t search all the data on the kintone database

Also, how can I add the date range in the search here?

Hello OM,

This occurs because the number of record data stored in the event object is equal to # of records shown on a page.
So even if you disable the pagination, no records will show up on the page because, in this case, no record data is stored in the event object.

More details about this pagination in custom views can be found on the following page:

Utilize the Pagination Option of the Custom View - Kintone Developer Program

To search all the data on an app, you will need to disable the pagination and use the Get Records API to get all records data.

The Three Methods for Bulk Record Retrieval - Kintone Developer Program

I hope this helps.

Best,
Chris

1 Like