Allows using Webix UI components with Meteor. Reactive widgets that have been tested include DataTable and List. All other widgets with linear underlying data structures should work too.
-
Add the webix package
meteor npm i --save webix meteor npm i --save webix-meteor-data
-
Define data collections as usual:
Movies = new Mongo.Collection('movies');
-
Initialize Webix components using "meteor->{collection}" as the data URL:
webix.ui({ view: 'datatable', editable: true, editaction: 'dblclick', autoconfig: true, // load data from the "movies" collection url: 'meteor->books', // save data to the 'movies' collection save: 'meteor->books' }
That is it.
Adding the url
property will enable data loading and automatic component updates when data changes in the
specified Collection.
The save
property ensures that all changes to the component will be saved back to the Collection.
Instead of using a string for the url
property, you can use cursors and collections directly.
Movies = new Mongo.Collection('movies');
var cursor = Movies.find();
webix.ui({
view: 'list',
url: webix.proxy('meteor', cursor)
});
Movies = new Mongo.Collection('movies');
webix.ui({
view: 'list',
url: webix.proxy('meteor', Movies),
save: webix.proxy('meteor', Movies)
});
Movies = new Mongo.Collection('movies');
webix.ui({
view: 'list',
url: webix.proxy('meteor', Movies.find()),
save: webix.proxy('meteor', Movies)
});
You can use load
method to (re)load data in the component.
$$('datatable').load('meteor->movies');
or
$$('datatable').load( webix.proxy('meteor', Movies.find()) );
Webix components have a sync method to synchronize data between components. The method can be used with Meteor.
Movies = new Mongo.Collection('movies');
$$('details').sync($$('datatable'));
Webix is published under the GPLv3 license.
This Meteor-Webix adapter is released under 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.