We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19328
    • 433 Posts
    This question has been asked before, but I'm still unsure what would be the best way to accomplish this. I hope someone can point me in the right direction.

    Our case: We have a large list of locations (100+) that need to be managed in MODX. Each location is a resource (pagetitle, content, etc.), with a couple of tv's. Showing them in the tree would not be practical.

    Therefore I want to hide all child resources (locations) of a given parent resource from the tree, and display them in a grid instead (on the parent resource?). Exactly like it's done in Articles, but if it's possible, I would like to also show the tv's that are used for the child resources, as columns in the grid. The grid columns would be (for example): id, pagetitle, city (=tv), street (=tv), tags (=tv). Ideally all the functionality that is present in Articles would be there (like search, a button for a new location, bulk actions, etc.).

    What would be the best way to go about this?

    1) Is this possible with MIGXdb, if so, how? I can only find tutorials for MIGXdb that use a custom db table. I want to use resources, because I think this will make it easier to display the resources with existing snippets (like getResources), and to search them with Advanced Search (for example). Or would you advise to create a custom db for the locations and not use modx standard resources?

    2) Or would it be smarter to adjust Articles in a way that it would display my custom tv's? Is this possible and is it very difficult? (I'm not a programmer).

    Does anyone know of any tutorials that explain how to accomplish this either way?
    Thanks for any help!
      • 3749
      • 24,544 Posts
      I'm afraid that showing a grid in the Manager, or adding TVs to the Articles grid would involve programming in ExtJS -- not for the fainthearted.

      In newer versions of MODX, resources have a show_in_tree field (and a checkbox for it on the Create/Edit Resource form) so it's easy enough to hide them. You could also hide them from some users with the Security system.

      I think one way to go without writing any code would be to do it in the front end (making the users log in first). You could use getResources to show your grid. You could use NewsPublisher to edit the resources and use an NpEditThisButton snippet tag in the getResources Tpl chunk to put an "Edit" button next to each one in the grid, which would launch NewsPublisher to edit the resource.

      I've never done that, but I think a couple other users have, so I think it's possible. It would still take some serious effort to set up.

      On second thought, there may be a way to add fields to the articles grid -- I've never tried. If that's the case, you might be able to set up a pseudo blog and make your resources Articles.




      ------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using.
      MODX info for everyone: http://bobsguides.com/modx.html [ed. note: BobRay last edited this post 14 years, 2 months ago.]
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        In newer versions of MODX, resources have a show_in_tree field (and a checkbox for it on the Create/Edit Resource form) so it's easy enough to hide them.
        What version would that be? I've got 2.2.4 and don't see this option. I do see the fields in the database, hide_children_in_tree and show_in_tree, but i don't see any checkboxes in the create/edit form.

        Actually, I don't see how that would work. If you have "hide in tree", how would you edit the resource? Use search to find it?
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 3749
          • 24,544 Posts
          My bad, I thought I had seen a checkbox for it (maybe in Articles?). In fact, an earlier version of Articles may have added that field and it might not exist in the basic install. I don't have any easy way to check. If you have an install handy where Articles has never been installed. Let me know if that field is in the site_content table.

          The OP wanted to hide them in the tree and show them using another method (as Articles does).

          [update] It's not in Articles either, I must have dreamed it (it is in my DB).



          ------------------------------------------------------------------------------------------
          PLEASE, PLEASE specify the version of MODX you are using.
          MODX info for everyone: http://bobsguides.com/modx.html
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 19328
            • 433 Posts
            BobRay, thanks for your response. I'm going to give MIGXdb a go (I'll just have to learn some programming I guess ;-). I already tried to add a column to Articles for a custom TV, I did get the extra column but filling it with the value of the tv's for each article was not that simple. I'll keep trying.
            Susan, I haven't seen that setting either. And indeed, how would you edit the resource...
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Hmm. Put in a brand-new installation, and those setting are in the site_content table, but there aren't any checkboxes when editing the resources.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 4172
                • 5,888 Posts
                will write a Tutorial today, how you can manage child-resources with help of a MIGXdb-TV-grid without writing a line of code, except perhaps some config-values in a php-config-file.
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 19328
                  • 433 Posts
                  Wow, that would be fantastic Bruno! Thanks in advance!
                    • 4172
                    • 5,888 Posts
                    Ok, very, very basic for now.

                    But its a start:

                    http://rtfm.modx.com/display/ADDON/MIGXdb.Manage+Child-Resources+in+a+grid-TV+with+help+of+MIGXdb

                    Just added the pagetitle and a richtext-field for the content for ediing and a default value for the template.
                    You can add as many Resource-fields as you want to the form.
                    How to add searching,filtering, automatic alias-creation and TV-editing follows later.

                    I'm hoping the rest will follow tomorrow.

                    Let me know, if its working for you so far.
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      This sounds exactly what I've been needing for easy management of a simple shop catalog! Each main product category can have a TV to handle its individual items. You get the flexibility of having it in the Tree if you need to access it at that level, but the simplicity and ease of use of a TV if that's all you need.
                        Studying MODX in the desert - http://sottwell.com
                        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                        Join the Slack Community - http://modx.org