Firebase adapter for Webix UI
Library allows using Webix components with FireBase
Latest version will work with Webix 6.2+, if you are using an older version of Webix, you need to use version 0.5 of this package.
Citing the Firebase site:
When data changes, apps built with Firebase update instantly across every device -- web or mobile.
Firebase-powered apps work offline. Data is synchronized instantly when your app regains connectivity.
Firestore
Include Webix and Firebase files on the page
<!-- Webix --><!-- Webix-Firebase adapter --><!-- FireBase -->
Create main firebase connection
firebase; // create firebase connection, and assign it to webixvar db = firebase;db; webixfirestore = db;
Init webix component, using "firebase->{reference}" as data url
webix
That is it.
Adding "url" property will enable data loading and automatic updates of component when data changed in the firebase.
Adding "save" property ensures that all changes in the datatable will be saved to the Firebase
Using FireBase references
Instead of using text url you can use firestore collections directly
firebase; // create firebase connection, and assign it to webixvar db = firebase;db; var proxy = webix; webix;);
Dynamic data loading
You can use "load" command to (re)load data in the component.
;;
or
;;
Realtime Database
Include Webix and Firebase files on the page
<!-- Webix --><!-- Webix-Firebase adapter --><!-- FireBase -->
Create main firebase connection
firebase; // create firebase connection, and assign it to webixwebixfirebase = firebase;
Init webix component, using "firebase->{reference}" as data url
webix
That is it.
Adding "url" property will enable data loading and automatic updates of component when data changed in the firebase.
Adding "save" property ensures that all changes in the datatable will be saved to the Firebase
Using FireBase references
Instead of using text url you can use firebase references directly
firebase;var db = firebase;var proxy = webix; webix;
Dynamic data loading
You can use "load" command to (re)load data in the component.
;;
or
;;
Sync api
Webix components have native sync api to sync data between components. The same api can be used with firebase
firebase;webixfirebase = firebase;var ref = webixfirebase; ;
Working with Forms and Templates
Similar to data views, you can use "load" and "save" API while working with Forms
//form;...; //template
In some cases, it has sense to not load data correctly but bind form ( template ) to some other view or data collection
var data = url:"firebase->books" save:"firebase->books"form;datawaitData
or, the same for the datatable
webix;form; //selected row will be shown in a form
Samples
- Grid, data loading and saving by url
- Grid, data loading and saving by reference
- Grid, syncing with reference
- Different components, data syncing
- Webix Kanban with FireBase backend
License
The MIT License
Copyright (c) 2015 Maksim Kozhukh
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.