We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22427
    • 793 Posts
    In the column of a listbox field in a CPM table in the manager I want to highlight cells differently, depending on their values (different text colors or background colors). Is there a way to do it? Can I use the renderChunk template? How is it used?

    This question has been answered by multiple community members. See the first response.

    • discuss.answer
      • 4172
      • 5,888 Posts
      yes, you can use the renderChunk - renderer

      this is an example, picked from one of my projects:

      <div style="margin: -8px;padding: 8px;[[+is_premium:is=`1`:then=`background-color:#F7E3D6;`]]">
      [[+fullname:notempty=`name:<strong> [[+fullname]]</strong><br/>`]]
      email: <a href="mailto:[[+email]]">[[+email]]</a><br/>
      [[+website:notempty=`url:<strong> [[+website]]</strong><br/>`]]
      [[+phone:notempty=`tel:<strong> [[+phone]]</strong><br/>`]]
      [[+address:notempty=`Strasse:<strong> [[+address]]</strong><br/>`]]
      [[+city:notempty=`stadt:<strong> [[+zip]] [[+city]]</strong><br/>`]]
      User:<strong> [[ifnotplaceholder? &value=`[[+User_username]]`]]</strong><br/>
      IP: <strong> [[+IP]]</strong>
      </div>
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        If you prefer not to have inline styling, you could use the same principle to just assign a classname to the element.
        <div [[+is_premium:is=`1`:then=`class="premium"`]]>

          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
          • 22427
          • 793 Posts
          Thank you, Bruno and Susan!
          Indeed I'd like to avoid inline styling. Is /manager/templates/default/css/index.css the right file to put the classes in?
          Edit:
          Certainly not, since it would be overwritten with a MODX upgrade. [ed. note: ottogal last edited this post 11 years, 8 months ago.]
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            You would probably be best off examining the existing classes used in the Manager, and use those classes. Find something that looks like what you want, use Firebug or something similar to locate the exact element and see what class is used for its styling.
              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
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              For example, the orange "Update" button in the Installer's package manager has this:
              <button class="controlBtn update orange" type="button">Update</button>
                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
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                You can make a copy of the default theme folder, rename it, make your changes, then in the System Settings select your "new" manager theme. You need to refresh the page before the changes to the index.css file will show up.
                  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
                  • 22427
                  • 793 Posts
                  I already had a look with Firebug into the index.css; this clumsy jungle of style definitions is incredible... For my aim I'll go back to the inline styles - works fine.
                  Thank you, Susan, for your advice, anyway.
                  • discuss.answer
                    • 4172
                    • 5,888 Posts
                    you can add some CSS directly to the CMP - description, in the CMP-settings - tab at the MIGX - configurator.

                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!