Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Calendar - remove / hide hours from the GUI?

    Hi, i using smarclient javascript.

    In the calendar object is it possible to remove / hide certain hours from the GUI?

    #2
    There' no current mechanism to hide rows in a calendar - but you can disable them if you like, by overriding shouldDisableDate(), something like the code below.

    However, note that there was a bug that caused shouldDisableDate() to be passed a logical date in vertical views - we've fixed the bug, but you'll need to wait for a build dated January 19 or later to get the fix.

    Code:
    shouldDisableDate : function (date) {
        var time = isc.DateUtil.getLogicalTimeOnly(date);
    
        // disable times before 9 and after 5
        if (time.getHours() <9 || time.getHours() > 17) return true;
    
        return this.Super("shouldDisableDate", arguments);
    }
    Last edited by Isomorphic; 18 Jan 2022, 13:55.

    Comment


      #3
      Hi Isomorphic
      Thanks for the reply.

      Another question: to assign a different background color to the disabled cells I tried using "getDateStyle" and "getDateCSSText":
      getDateCSSText: function(...){
      //some code...
      return "background-color: ...;"
      }
      or
      getDateStyle: function(.....){
      //some code...
      return "customClassCssName"
      }

      "customClassCssName" is defined in css file

      Neither has changed the background color.
      Are the functions correct to use?
      If so, is there any example that can help?

      Comment


        #4
        getDateCSSText() is the way to do this, and it works in our testing just now, code below - did you test with today's build?

        If you have further questions, please confirm your SmartClient version - we always need this information.

        Code:
        getDateCSSText : function (date) {
            return "background-color:lightgreen;";
        }

        Comment


          #5
          Hi @Isomorphic.
          Thanks also for this answer.
          The "getDateCSSText" function is correct.
          The error was mine, there was a problem in the return string.

          Thank you.

          Comment

          Working...
          X