Guide applies to: modern

Getting Started using Exft JS Add-on Components using Cmd

This guide covers adding one of the Ext JS add-on components to your application using Cmd.

Requirements

Download the Ext JS Addons Zips

There are two zip files you need to download. First download the Ext JS SDK Zip. Secondly download the Ext JS Addons zip.

Zip NamePath to Add-onsDescription
Ext JS SDK[zip]/packages/This zip contains the Ext JS SDK and standard Addons components
Ext Premium Addons[zip]/packages/The Premium add ons include Calendar, Exporter, D3, Pivot, and Froala editor components

Start a Trial

If you already signed up for the trial you can skip this step. This sign up form sends you an email with the download links.

Download Zips from the Support Portal

Existing customers can log into the portal’s downloads section and download both zips.

Add the Add-on Component to your Project

Step 1: Extract the zip

Open the zip and extract the resources into a folder that you can keep as a reference to Ext JS resources.

Step 2: Copy the Add-on package

In this step, you copy the add-on package to your project. And in this example we will use the Calendar add-on as the example package.

  • In your project root, create a folder called [project]/packages/local.
  • Copy the add-on package [zip]/calendar to [project]/packages/local/calendar.

Step 3: Declare the Package in app.json

In the project’s app.json requires property, declare the new package dependency calendar or whatever the package name is.

Example app.json:

  1. "requires": [
  2. "font-awesome",
  3. // Declare the add-on components package here
  4. "calendar"
  5. ],

Specific Example of app.json:

  1. {
  2. "name": "MyApp",
  3. "namespace": "MyApp",
  4. "version": "1.0.0.0",
  5. "framework": "ext",
  6. "toolkit": "modern",
  7. "theme": "theme-material",
  8. /**
  9. * The list of required packages (with optional versions; default is "latest").
  10. *
  11. * For example,
  12. *
  13. * "requires": [
  14. * "charts"
  15. * ]
  16. */
  17. "requires": [
  18. "font-awesome",
  19. // Declare the add-on components package here
  20. "calendar"
  21. ],
  22. //...

Step 4: Add the Add-on Component to a View

In this step, add the enterprise component to one of the applications views. In this example, the calendar package will be added to the Main.js view.

Example:

  1. {
  2. title: 'Home',
  3. iconCls: 'x-fa fa-home',
  4. layout: 'fit',
  5. items: [{
  6. xtype: 'calendar'
  7. }]
  8. }

Specific Example [cmd_project]/app/view/main/Main.js:

  1. /**
  2. * This class is the main view for the application. It is specified in app.js as the
  3. * "mainView" property. That setting causes an instance of this class to be created and
  4. * added to the Viewport container.
  5. */
  6. Ext.define('MyApp.view.main.Main', {
  7. extend: 'Ext.tab.Panel',
  8. xtype: 'app-main',
  9. requires: [
  10. 'Ext.MessageBox',
  11. 'Ext.layout.Fit'
  12. ],
  13. controller: 'main',
  14. viewModel: 'main',
  15. defaults: {
  16. tab: {
  17. iconAlign: 'top'
  18. }
  19. },
  20. tabBarPosition: 'bottom',
  21. items: [
  22. // TODO - Replace the content of this view to suit the needs of your application.
  23. {
  24. title: 'Home',
  25. iconCls: 'x-fa fa-home',
  26. layout: 'fit',
  27. // The following grid shares a store with the classic version's grid as well!
  28. items: [{
  29. xtype: 'calendar'
  30. }]
  31. },{
  32. title: 'Users',
  33. iconCls: 'x-fa fa-user',
  34. bind: {
  35. html: '{loremIpsum}'
  36. }
  37. },{
  38. title: 'Groups',
  39. iconCls: 'x-fa fa-users',
  40. bind: {
  41. html: '{loremIpsum}'
  42. }
  43. },{
  44. title: 'Settings',
  45. iconCls: 'x-fa fa-cog',
  46. bind: {
  47. html: '{loremIpsum}'
  48. }
  49. }
  50. ]
  51. });

Step 5: Try it out

Run sencha app watch to test out the application after the calendar has been added.

What’s Next

Now you’re ready to move to the next stage of using all the Ext JS Components.