Webix Jet Framework
Webix Jet is a client-side JavaScript micro-framework designed to simplify the development and maintenance of single-page applications (SPAs) built with Webix UI components. As of version 3.0.3, it offers a structured approach to app creation through modules like apps, views, models, and services, implemented as ES6 classes. The framework emphasizes modularity, reusability, and efficient code organization, making it suitable for complex data management applications. Key differentiators include its lightweight footprint (under 10kb minified), a robust plugin system for common functionalities (e.g., menus, localization, authentication), and flexible routing capabilities. Since version 3.0, Webix Jet has migrated its default toolchain to Vite, while still maintaining compatibility with Webpack. It also boasts comprehensive TypeScript support since version 1.3, providing improved development experience with type safety and auto-completion. The project is actively maintained, with a cadence of significant major releases every few years and more frequent minor updates and patches, as confirmed by its documentation and community support.
Common errors
-
ReferenceError: webix is not defined
cause The Webix library object is not accessible in the global scope (window.webix), which Webix Jet components often expect. This typically happens with module bundlers that don't automatically expose `webix` globally.fixEnsure `window.webix = webix;` is executed in your main application entry point after importing the Webix library, or load Webix via a `<script>` tag before your application bundle. -
Event 'app:error:render' triggered: Error rendering view
cause An error occurred during the rendering of a Webix UI component defined within a JetView's `config()` method, indicating an incorrect UI configuration.fixCheck the `config()` method of the problematic JetView for syntax errors, incorrect Webix UI component properties, or invalid nesting. Enable debug mode (`debug: true` in `JetApp` config) for more detailed console logs. -
Event 'app:error:initview' triggered: Error initializing view
cause An error occurred during the initialization of a JetView, indicating an issue with the JetView's lifecycle methods (e.g., `init()`, `urlChange()`) or its integration with Webix UI, rather than a direct UI config problem.fixInspect the `init()` and other lifecycle methods of the affected JetView for logical errors or incorrect API calls. Use the debug mode to trace the execution flow and identify the source of the error. -
Data is not loading into Webix UI component in JetView
cause Incorrect usage of `parse()` or `load()` methods, or the data structure provided to a Webix data-bound component (like `datatable`, `list`) within a JetView does not match expectations.fixEnsure you are calling `this.$$(id).parse(data)` or `this.$$(id).load(url)` within the `init()` method or a data loading handler, and that the `data` or `url` resolves to a compatible format for the Webix component. Verify the data structure. -
Cannot find UI component with id 'myId' using this.$$('myId')cause The `this.$$()` method in Webix Jet scopes its search for Webix widgets only within the current `JetView`. The component with `id='myId'` might be in a parent view, a subview, or incorrectly referenced.fixIf the component is in a parent view, use `this.getParentView().$$('myId')` or pass the ID to a global `webix.$$('myId')` if it's a top-level ID. If it's in a dynamic subview, ensure the subview is loaded before attempting to access its components. Verify the ID is unique within the intended scope.
Warnings
- breaking Webix Jet v3.0 migrated its default toolchain from Webpack to Vite. Existing projects might require updates to `vite.config.js`, `.env` files, and `package.json` scripts to align with the new build process.
- breaking Starting with Webix Jet v3.0, several API methods changed their behavior. Notably, `getUrl()` and `getUrlString()` for app and view, and the `refresh()` method now returns a Promise, requiring asynchronous handling. `removeView()` of Webix widgets now correctly triggers `destroy()` of nested Jet views.
- gotcha When using module bundlers (especially Vite), the underlying Webix library must often be exposed globally as `window.webix` for Webix Jet components and certain Webix UI functionalities to work correctly. Directly importing `webix` may not always achieve this global availability automatically.
- gotcha Asynchronous operations within a `JetView`'s `config()` method, such as fetching data for UI construction, can lead to rendering issues or 'core.js' errors if the UI configuration is not returned as a Promise that resolves when the data is ready.
- deprecated The `WJET` utility for faster prototyping was deprecated with Webix Jet v3.0. While it might still function, its use is discouraged in favor of the standard JetApp/JetView class-based approach and the recommended build tools.
Install
-
npm install webix-jet -
yarn add webix-jet -
pnpm add webix-jet
Imports
- JetApp
const { JetApp } = require('webix-jet');import { JetApp } from 'webix-jet'; - JetView
import JetView from 'webix-jet/sources/views/jetview';
import { JetView } from 'webix-jet'; - plugins
import * as plugins from 'webix-jet/plugins';
import { plugins } from 'webix-jet'; - webix (global)
import 'webix';
import * as webix from 'webix'; window.webix = webix;
Quickstart
import { JetApp, JetView } from 'webix-jet';
import 'webix/webix.css'; // Or your custom Webix skin
import * as webix from 'webix';
// Ensure Webix is globally available for the UI components
(window as any).webix = webix;
class TopView extends JetView {
config() {
return {
rows: [
{ view: 'toolbar', elements: [{ template: 'My JetApp', type: 'header' }] },
{ template: 'Welcome to your Webix Jet application!', autoheight: true, borderless: true, css: 'webix_shadow_medium' }
]
};
}
}
class MyApp extends JetApp {
constructor(config = {}) {
const defaults = {
start: '/top',
views: { top: TopView }, // Define how to resolve 'top' to TopView
debug: true
};
super({ ...defaults, ...config });
}
}
webix.ready(() => {
new MyApp().render(document.body);
});