• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Re-using Components in same app

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Re-using Components in same app

    There is something I've struggled with for a long time, so I figured it was time to do it the best practice way instead of working around the issue.

    I have situations where I have relatively large apps and would like to use components in different views. To date, I have just duplicated the component and given it a new name as I have not been able to figure out how to reference it in different views.

    For example, a Combobox that allows the user to search vendors by name. This combobox may appear in different Tabs, Grids, Windows or Forms. I'm pretty sure I only have to have one instance of this component. However, when I try to use it the second or more times, it's as if the app always uses the original instance in the view that originally contained it rather than the view the user is trying to use it in.

    I'm sure there's a simple technique that allows for this but I've never been able to figure it out and my guess is it may be something to do with an itemid or and id property.

    Another example is a grid. One tab may contain this grid that display the store in a certain fashion while another tab may filter it differently. The store and columns in the grid are always the same, but the backend processing is different. So there is no reason to make two grids. I should be able to use it in as many different views as needed.

    Any hints on how to handle this would be much appreciated.




  • #2
    We suggest using a workspace and creating a common package in your workspace. Then any reusable utilities/components/views that are in the common package can be used across any applications in the workspace that requires that package. As for the grid, you could just have one grid and use a chained store for one of your grid references. Not sure the version of ExtJs you're using but here is a link to the docs for 6.2 on chained stores.

    I would also suggest looking at the Valence Development Guide.

    Comment

    Working...
    X