0

An idea for a Ninext tweak.



Would this be possible?

To have a tooltip concept when hovering over a cell that displays the full content of that cell.  This could be handy where cell width is reduced, and the text is cut off.

8 replies

null
    • Ninox developper
    • Jacques_TUR
    • 5 mths ago
    • Reported - view

    You can try this JavaScript function which modifies the tooltip of the chmap whose name is passed as a parameter.

    function setTooltip(fieldName : text,tooltip : text) do
        var fn := fieldName;
        var tt := tooltip;
        #{:text
            // find the component nammed fn
            var r = ui.getCurrentEditor().currentTab.components.find( c => c.field.caption == fn)
            // set tooltip on tp
            if (r && r.el[0])
            r.el[0].title = tt;
        }#
    end;
    

    You can place the function in the "Display only if..." trigger so that the tooltip is updated each time the field is modified.

    Ideally, you should put the function in the global functions so that you can call it from any field in the database.

    Please note: it is not possible to call the function from an "After update" trigger as this is executed on the server and not locally.

      • Alan_Cooke
      • 5 mths ago
      • Reported - view

       Hi there,  I tried this in Display if and result was that the field did not display at all (same as a null).  Do I need to substitute anything in the sample code or simply copy and past into the field Display if.

      • Ninox developper
      • Jacques_TUR
      • 5 mths ago
      • Reported - view

       just add « true » at the end of code. 
       

      function setTooltip(fieldName : text,tooltip : text) do
          var fn := fieldName;
          var tt := tooltip;
          #{:text
              // find the component nammed fn
              var r = ui.getCurrentEditor().currentTab.components.find( c => c.field.caption == fn)
              // set tooltip on tp
              if (r && r.el[0])
              r.el[0].title = tt;
          }#
      end;
      
      true;
      
      • Alan_Cooke
      • 5 mths ago
      • Reported - view

       I tried that but it does not work, I assume I am doing something wrong.  Copied the sample code into Display if.   Field now shows but hovering over the field has no effect.

      • Ninox developper
      • Jacques_TUR
      • 5 mths ago
      • Reported - view

       Sorry, I forget to call function 😅

      Replace "YOUR FIELD NAME" by the name of field. 

      function setTooltip(fieldName : text,tooltip : text) do
          var fn := fieldName;
          var tt := tooltip;
          #{:text
              // find the component nammed fn
              var r = ui.getCurrentEditor().currentTab.components.find( c => c.field.caption == fn)
              // set tooltip on tp
              if (r && r.el[0])
              r.el[0].title = tt;
          }#;
      
      end;
      setTooltip( "YOUR FIELD NAME", "The value of tooltip" );
      true;
      
      • Alan_Cooke
      • 5 mths ago
      • Reported - view

       100% - Now I can remove the Alert to display the full field value in OnClick.

    • Alan_Cooke
    • 5 mths ago
    • Reported - view

    Is it possible to have this function in (all), sheet, table mode?
     

    In other words, if a column is too narrow the DESCRIPTION would display on hover.

      • Ninox developper
      • Jacques_TUR
      • 4 mths ago
      • Reported - view

       Apologies for the delayed response.

      I have a simple solution that should meet your needs. Add the following code to the ‘Display only if’ trigger of your list (or any field on your form):

      #{
      document.querySelectorAll(".component.editor.editor-list.editor-4col")
          .forEach(l => l.onmouseover = (event) =>
              document.querySelectorAll(".nx-table__body__cell--string")?.forEach(e => e.title = e.textContent)
          )
      }#;
      true
      

      This script adds an onMouseOver event to all displayed lists. When the mouse hovers over a list, the code searches for cells containing text values and copies their content to the title attribute, which is responsible for displaying the ToolTip.
       

Content aside

  • Status Answered
  • 4 mths agoLast active
  • 8Replies
  • 103Views
  • 2 Following