1. #1
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    64
    Vote Rating
    6
    jim@carroll.net is on a distinguished road

      0  

    Default Best practice -- Comboxboxes & Stores

    Best practice -- Comboxboxes & Stores


    Looking for advice on Best Practice w/ Architect.

    Each combobox is bound to a store. In an application with dozens or even 10's of dozens of comboboxes, this leads to 'store-sprawl' in the architect interface. If many of the combo's are displaying static data, this seems like unnecessary clutter.

    One idea that has occurred to us is to initialize the store in an event handler bound to the Combobox (say onBoxReady).

    How do most people deal with this? Do you just accept the store-sprawl, or do you implement some sort of clever re-org?

  2. #2
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,329
    Vote Rating
    212
    ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold

      1  

    Default


    There are some ways to avoid the "store-sprawl" but depends on what you define as static data.

    If you mean static data as CONSTANT data (a combo box asking for gender or case status or alike) and you will use several times such combo boxes, create custom components.

    For example, "GenderCombo", create an override then write something like this:

    Code:
    Ext.define('MyApp.view.override.GenderCombo', {
        requires: 'MyApp.view.GenderCombo'
    }, function() {
        Ext.override(MyApp.view.GenderCombo, {
            initComponent : function() {
                var me = this;
                me.store = [['M', 'Male'], ['F', 'Female']];
                me.callOverridden(arguments);
            }
        });
    });
    Hope this helps.

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  3. #3
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    64
    Vote Rating
    6
    jim@carroll.net is on a distinguished road

      0  

    Default


    +1

    This is excellent advice. I had briefly considered overrides, but rejected it thinking the combo's were not necessarily repeating enough to justify separate class files. But then I thought about it -- and realized that's nuts...with dozens of combo's there very little chance they are all completely unique. After this occurred to me, I realized this was an excellent chance to enforce DRY (don't repeat yourself).

    Thanks much.

  4. #4
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    64
    Vote Rating
    6
    jim@carroll.net is on a distinguished road

      0  

    Lightbulb Minor hitch...

    Minor hitch...


    The idea of using the override pattern with comboboxes to collect CONSTANT/static stores together is a good one. But this brings up a minor hitch.

    Architect tosses a warning message during the 'Deploy' phase that the linked instance is missing a store. There are two inconvenience's with this. First -- you have to read the box on every deploy to make sure you aren't ignoring something that matters. And second -- it's yet another buttong to hit in the edit-save-deploy-preview cycle (I'm starting to get carpal tunnel syndrome from all the clicking).

    This second point is a bit of a pain. We do quite alot of incremental development: edit-save-deply-preview. And because our has to be published to a server to actually test the Ajax functionality, this is quite a few steps. For example:

    * Click 'Save'
    * Click 'Deploy' (read over warning about missing stores)
    * Click 'Yes' to deploy even with missing stores
    * Click 'Close'

    Switch to another window -- run rsync script to upload App to server.

    Switch to Firefox, click reload....then start actually testing app.

    I don't mean to gripe -- Architect is an excellant tool, and it's worth the effort. Please consider this the musing of a customer hoping to maybe get on the radar screen of the Architect prodcut development team <grin>.

    So how could it be done better? I think Visual Studio has it right. It has an Output Window that captures all the relevant bits of the compile/publish phase in raw text format. If you want to scan for details you can. They then extract warnings and errors to a color-coded summary screen -- one warning/error per row . You can then click the row to be brought to the relevant line in the Output window.

    Thanks.
    Jim C

  5. #5
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,329
    Vote Rating
    212
    ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold ssamayoa is a splendid one to behold

      0  

    Default


    I asked several months ago to allow developers to select "dont show again" for missing stores.

    An option is: create an empty store and assign them to the "static" combo boxes so they aren't included in the warning message.

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  6. #6
    Sencha - Architect Dev Team Phil.Strong's Avatar
    Join Date
    Mar 2007
    Location
    Olney, MD
    Posts
    1,953
    Vote Rating
    65
    Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice

      1  

    Default


    Yeah we plan to build out the project build and verification step in 2.1+ so I imagine this will no longer be a pop up at that point.
    Phil Strong
    @philstrong
    #SenchaArchitect
    Sencha Architect Development Team

  7. #7
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    64
    Vote Rating
    6
    jim@carroll.net is on a distinguished road

      0  

    Default


    That sounds great. Consider us willing to beta-test.