1

Hiding elements - HUD control

In case this might helps folks here are a couple of helps.  Please feel free to add anything to this post that relates to the Title.
-------------------------------------------------------------------
The formula for this has the following in the On Click event.

if HUD = true then HUD := false else HUD := true end

A Yes/No (in my case HUD) is toggled to display via On Click.

Note:  Every TAB in a form requires a formula (only one HUD yes/no) with the script.  I use a convention of 'HUD-tabname' 

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

The formula is styled to be completely invisible placed somewhere on the form - it cannot be hidden (null, void etc).  The Yes/No can be hidden.  To toggle the HUD elements on/off simply click the invisible formula.

 

If someone could figure out a way to have this as a Global - WOW!

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

---- First section hides everything including sidebar, attachments and comments but does not hide Ninext filter----
if HUD then
html("
    <style>
    .sideeditor-buttons-left .button{display: none;
    height: 0px;}
    .popupeditor2-buttons-left .button{display: none;}
    .stringeditor .stringeditor-button2{display: none;}
    .nx-backplane .popupeditor.pane .nx-button-text.blue{display: none;}
    .tab.tab-icon{display: none;}
    .hud-menu-right{display: none;}
    .HudLeftHeader_root .nav-item.head.FastClickContainer_root{display: none;}
    .nav-item.head.HudLeftHeader_backButton.FastClickContainer_root{display: block;}    
    .HudContainer_body{display: none;}
    </style>
")
end

------This one hides everything including Ninext filter, Search, Gear, Filter, sidebar.  Basically everything between  the TABS row and the VIEWS Row.  Attachments and Comments remain------

if HUD then
    html("
<style>
.hud-menu-button.menu-icon.menu-icon-trash{display: none;}
.hud-menu-button.menu-icon.menu-icon-duplicate{display: none;}
.hud-menu-button.menu-icon.menu-icon-print{display:none ;}
.hud-menu-button.menu-icon.menu-icon-add{display: none;}
.hud-menu-group, .hud-menu-right{display:none;}
.hud-menu-button.i-32-24.i-white.i-setting-tool.--ul-admin-button.admin-button{display:none;}
</style>
")
end

10 replies

null
    • Ruben
    • 11 mths ago
    • Reported - view

    I was frantically looking for the bottom code in my notes but couldn't find it, glad I found it here!!

    However, is it correct then that this

    1.) has to be scripted into a DEDICATED formula field on each tab? I tried using the script on the tabs itself, didn't work, tried putting it before one of my header styled formulas per tab, didn't work. I really have to use an own formula field just for this piece of code?

    2.) Tried implementing a similar formula field in the table overview (main page).. also was not able to block the buttons, so I assume there is no way of blocking that bottom button at the table either? This is the most annoying one, this is the one that constantly creates empty database entries and it is a shame ninox hasn't come up with a way to block this one or at least allow for a confirmation prompt or similar. 

      • Alan_Cooke
      • 11 mths ago
      • Reported - view

      Ruben Yes.  Every TAB needs it's own formula.  I will provide more detail tomorrow.

      • Ruben
      • 11 mths ago
      • Reported - view

      Alan Cooke Thanks, anything helps to make the CRM in its vanilla form as user-friendly as possible. 

      • Ruben
      • 11 mths ago
      • Reported - view

      Alan Cooke Hi again, Alan. Was wondering if you have anything more to add to this. 

      I'm especially curious to hear if you have any advice on blocking the + button on the table overview (spreadsheet-style tabular views)?

      • Sean
      • 11 mths ago
      • Reported - view

      Ruben Hi, I think this is what you are looking for...

      .i-light-grey.i-plus{display:none}

      • Sean
      • 11 mths ago
      • Reported - view

      Ruben Right, sorry about that. I realized after I posted that the Formula field version won't work if just the Table view is open. This is code you can put in Trigger after open and if you want you can put all of the rules there.

      dialog("Console CSS Modifier", html("<script>
          var styleSheet = document.styleSheets[2];
          styleSheet.insertRule('.i-light-grey.i-plus{display:none}');
          var interval = setInterval(() => {
              var bt = document.querySelector('.nx-alert .nx-button-text');
              if (bt) {
                  bt.click();
                  clearInterval(interval);
              }
          });
      </script>"), ["close"])
      

      You need to add styleSheet.insertRule for each additional rule.

      • Ruben
      • 11 mths ago
      • Reported - view

      Sean Thanks. Yes, this actually helps remove the + symbol, but only visibly. The problem is that when people search for an entry, then "misclick" just underneath it, they create a new file

      And there's no script-based function of blocking new records, only through restriction of rights. It is also not possible to block creating new entries entirely, and then "allowing" it through a button or similar, it seems if people are restricted from creating with the "+" they are equally restricted when they are pushing a button.

      I haven't tried do as server though, I wonder if that would make a difference. Anyway, I will mention it at the Open Consultation Hour in 10 minutes

      • Ruben
      • 11 mths ago
      • Reported - view

      Sean Update: According to Ben Lucas, there is no known possibility to actually block this function at the moment but is planned for one of the next bigger updates. 
       

      The only other way I know to work around this is to automatically trigger "delete the last record"  on the "when creating new record" trigger, at least that can be controlled via boolean field or other script etc.

      And then I can at least avoid accidental empties. Not a good choice for billing, of course. And the disadvantage is that you end up having a bunch of deleted hidden records. 

    • Ruben
    • 11 mths ago
    • Reported - view

    Hi Sean, I can place this in the tab, and then this works when a record is popped up. 
    But unfortunately, I can't make the + disappear when no record is popped up, it automatically comes back.

    Also, although the plus is suppressed, clicking there still generates a new record. 

    I really wish ninox would give us a way of blocking this unnecessary and honestly quite counter-productive feature.

    • Sean
    • 11 mths ago
    • Reported - view
    Ruben said:
    According to Ben Lucas, there is no known possibility to actually block this function at the moment but is planned for one of the next bigger updates. 

     We have been asking for that for some time now... Urgent change

    Frank Böhmer had the last comment in the thread and below is the English translation...

    The paradigm of Ninox is to always save changes directly. To implement the requested change we would have to change the entire template to an explicit confirmation (OK button). It's a compromise. You can implement your own button that will set a certain state only if all validations pass.

    Last year I found the function 

    return e.create(),void(0,s.j)("Table","CreateRecord")

    and replaced it with

    void e.selectNothing()

    in the main.js file for the Mac app on my computer and clicking on that row no longer added a new record. I tested it again just now and it still works.

    I sent a DM and email to Jacques TUR last year asking if he would be interested in incorporating this in his Ninext project. It will be interesting to see who comes up with a solution first. 😁

Content aside

  • 1 Likes
  • 10 mths agoLast active
  • 10Replies
  • 513Views
  • 4 Following