Results 1 to 4 of 4

Thread: Custom Components in Packages

  1. #1
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    114

    Default Custom Components in Packages

    Hi all,

    I have a workspace I generated with sencha cmd.
    I then created an app.
    I now want to create custom components that can be used across multiple apps.
    I ran "sencha generate package common" from my workspace and it created something in local/packages.
    In the src here I created a file called Test.js.
    This files is a simple Component that extends Ext container and has html of Test.

    I now want to use this in my app.

    I'm reading things from multiple sources and seems a bit different.

    Do I need to run sencha package build?
    If I do I the following error.
    om.sencha.exceptions.ExNotFound: Unknown definition for dependency : Ext.container.Container

    I'm completely at a lost here. I think my package has to bring in ext framework but I have no Idea how...

    Any help is appreciated.

  2. #2
    Sencha Premium User
    Join Date
    Nov 2016
    Posts
    13

    Default

    You don't have to run sencha package build unless you want to maintain remote repository.
    All you need is just add package name to requires section of your app.json

    I'm completely at a lost here. I think my package has to bring in ext framework but I have no Idea how...
    You need to point your newly generated package to the framework by adding
    PHP Code:
    package.framework=ext 
    into .sencha/package/sencha.cfg

  3. #3
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    114

    Default

    Quote Originally Posted by kot_lex View Post
    You don't have to run sencha package build unless you want to maintain remote repository.
    All you need is just add package name to requires section of your app.json


    You need to point your newly generated package to the framework by adding
    PHP Code:
    package.framework=ext 
    into .sencha/package/sencha.cfg
    Yep, you are right! I also didn't have to change the sencha.cfg. Have it working now!

    Quick question. If I require the package in my app, will it automatically bring in everything from the package or do I have to require the component in my views to get it?

  4. #4
    Sencha Premium User
    Join Date
    Nov 2016
    Posts
    13

    Default

    Quote Originally Posted by fily55 View Post
    Yep, you are right! I also didn't have to change the sencha.cfg. Have it working now!
    I couldn't find a way to avoid editing sencha.cfg in case I need to build package with sencha package build.

    Quote Originally Posted by fily55 View Post
    Quick question. If I require the package in my app, will it automatically bring in everything from the package or do I have to require the component in my views to get it?
    I believe it should be enough if you require package just once in your app.json file.

Similar Threads

  1. Using ExtJS packages as NPM packages
    By venom.web.dev in forum Ext JS 6.x Q&A
    Replies: 1
    Last Post: 1 Feb 2018, 8:21 AM
  2. Replies: 1
    Last Post: 3 Feb 2014, 11:20 AM
  3. custom components and MVC in ST2
    By gkatz in forum Sencha Touch 2.x: Discussion
    Replies: 8
    Last Post: 21 Jun 2012, 3:24 AM
  4. Packages, Containers, Components and Classes??
    By Hollywood in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 4 Aug 2010, 9:25 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •