Giter Site home page Giter Site logo

ionic-team / demo-offlinestorage-search Goto Github PK

View Code? Open in Web Editor NEW
16.0 7.0 6.0 6.56 MB

Advanced Search functionality powered by Ionic Offline Storage plugin

Home Page: https://ionicframework.com/docs/enterprise/couchbase-lite

License: Other

JavaScript 0.22% TypeScript 98.69% HTML 0.45% SCSS 0.63%

demo-offlinestorage-search's Introduction

Demo App: Ionic Offline Storage - Advanced Search

This is a reference app that demonstrates how to build advanced search into an Ionic app using the Offline Storage solution from Ionic Native.

Note: This demo app is for reference purposes only. Specs: @ionic/angular 4.7.1, Angular 8.

What Does the App Do?

Demo video ๐Ÿ‘‡

Offline Storage video

It demonstrates the usage of Offline Storage to implement an advanced search experience in an Ionic app that works on iOS and Android. The app consists of an Employee Directory, listing company information such as title, office, and other details. Users can search employees by name or use a variety of filters (office, location) to find the desired employee. Under the hood, the Offline Storage plugin is used to store employee data in a Couchbase Lite database and cover all advanced search functionality.

Either native app runtime (Cordova or Capacitor) can be used to deploy the app to a mobile device.

Implementation Details

This is a modified version of the Ionic blank starter project. There are 3 major components:

  • The Employee List page (src/app/employee-list). Displays a list of all employees in the directory. Users can search for employees by first name or launch the filter modal to refine the results.
  • The Employee Detail page (src/app/employee-detail). Tap on an Employee to load a page that displays their details.
  • The Employee Filter page (src/app/employee-filter). Uses Offline Storage to execute search queries based on selected filters.
  • The EmployeeService class (src/app/services/employee.service.ts). The advanced search implementation powered by Offline Storage.

While of course there is more work involved to build the complete advanced search experience (creating the UI, etc.), the following shows how easy it is to create powerful queries in just a few lines of code:

const query = 
  QueryBuilder.select(SelectResult.all())
    .from(DataSource.database(this.database))
    .where(Expression.property("office").like(this.formatWildcardExpression(office))
      .and(Expression.property("department").like(this.formatWildcardExpression(department)))
      .and(Expression.property("firstName").like(this.formatWildcardExpression(firstName))))
    .orderBy(Ordering.property('lastName').ascending());
    
const results = await (await query.execute()).allResults();

How to Run

NOTE: This app requires an Ionic Native key in order to install and use the Ionic Auth Connect plugin. Ionic Native includes a reliable set of Native APIs & functionality that you can use in your Ionic app, quality controlled and maintained by the Ionic Team. If you are interested in acquiring a key or learning more, please contact us here.

  1. Clone this repository.
  2. Run npm install.
  3. Follow the Offline Storage plugin installation instructions here.
  4. Build and Deploy to an Android or iOS device.

Resources

demo-offlinestorage-search's People

Contributors

dotnetkow avatar mlynch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.