MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Modul CalendarExt3Agenda

    Scheduled Pinned Locked Moved Solved Troubleshooting
    12 Posts 3 Posters 2.0k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • O Offline
      Old_Death
      last edited by sdetweil

      Hello,
      I would like to combine the two functions eventFilter and eventTransform.
      Here is the example:

      eventFilter: (ev) => {
      if (ev.title.search(“Natalia:”)) return false
      return true
      },
      eventTransform: (ev) => {
      if (ev.title.search(“Natalia:”) > -1) ev.title=ev.title.replace(“Natalia:”,“”);
      return ev
      }

      But only the first function (Filter) works, but not the second (Transform)

      Can someone please help me with this?
      Thanks

      M 1 Reply Last reply Reply Quote 0
      • O Offline
        Old_Death @MMRIZE
        last edited by

        @MMRIZE Thank you very much, it works now!

        1 Reply Last reply Reply Quote 0
        • M Offline
          MMRIZE @Old_Death
          last edited by

          @Old_Death
          It is contradiction. You can’t do both thing - drop the event or replace the title at same time. What is your purpose? (And filtering is executed primarily than transforming)

          1 Reply Last reply Reply Quote 0
          • O Offline
            Old_Death
            last edited by

            I only want the dates to be shown with the title “Natalia”. These titles should then be changed. The text “Natalia” should be removed here.

            M 4 Replies Last reply Reply Quote 0
            • M Offline
              MMRIZE @Old_Death
              last edited by MMRIZE

              @Old_Death
              You want;

              1. Only events which have title “Natalia” would be shown, others should be filtered out.
              2. Then the event (with title “Natalia”) should change its title. Right?
              1 Reply Last reply Reply Quote 0
              • M Offline
                MMRIZE @Old_Death
                last edited by MMRIZE

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • M Offline
                  MMRIZE @Old_Death
                  last edited by

                  @Old_Death
                  Sorry, there was a bug that filtering or transforming performs twice, I’ll fix it soon.

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    MMRIZE @Old_Death
                    last edited by

                    @Old_Death
                    I updated it to 1.4.4. Please update or reinstall the module.
                    I found a bug about twice applying the user event filter/transformer on the drawing miniMonth and agenda board.
                    However, that is not the real reason for your symptoms. You just made a mistake on your filtering. (You drop out “Natalia” events by filtering, so they were not able to be transformed.)

                    Anyway, here is my example.

                    eventFilter: (ev) => {
                    	return (ev.title.search('Test') > -1)
                    },
                    eventTransformer: (ev) => {
                    	ev.title = ev.title.replace('Test', '@')
                    	return ev
                    }
                    

                    This code means

                    1. Filter out all other events except the event which has Test in the title.
                    2. Then transform Test to @.

                    You can see the result below;

                    ORIGINAL
                    21e51508-cc39-4d7c-b4e3-26bf529fffa3-image.png

                    CONFIGURED
                    110dc1c0-e375-4fe4-afc7-aa69228d9636-image.png

                    O 2 Replies Last reply Reply Quote 0
                    • O Offline
                      Old_Death @MMRIZE
                      last edited by sdetweil

                      @MMRIZE
                      thanks for the answer and the patch.

                      I installed this, but unfortunately there was no improvement in the result.
                      If I enter it like in the example, there are no more entries.

                      The points for the appointments are only displayed correctly in the mini calendar.

                      Here is my config for the module.

                      {
                            module: "MMM-CalendarExt3Agenda",
                            carouselId: "Seite2",
                            position: "top_left",
                            header: "Natalia",
                            config: {
                            instanceId: "basicCalendar",
                            locale: 'de-DE',
                            firstDayOfWeek: 1,
                            startDayIndex: -1,
                      		  endDayIndex: 15,
                            onlyEventDays: 15,
                            eventFilter: (ev) => {
                      	         return (ev.title.search("Natalia:") > -1)
                            },
                            eventTransformer: (ev) => {
                      	         ev.title = ev.title.replace("Natalia:", "")
                      	         return ev
                           }
                           }
                           },
                      
                      M 1 Reply Last reply Reply Quote 0
                      • O Offline
                        Old_Death @MMRIZE
                        last edited by

                        @MMRIZE said in Modul CalendarExt3Agenda:

                        ’
                        I also have a fundamental question of understanding.
                        The ’ character is used in the examples here.
                        I have to use the character " for it to work.
                        Why is that?

                        S 1 Reply Last reply Reply Quote 0
                        • S Away
                          sdetweil @Old_Death
                          last edited by sdetweil

                          @Old_Death I’m javascript, both the single and double quotes are acceptable

                          note. sometimes in the forum if the text is not in a code block, these characters are shown as word processing form , curved, like this
                          ’
                          or
                          "
                          Instead of the text form

                          ' or "
                          

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

                          1 Reply Last reply Reply Quote 0
                          • 1
                          • 2
                          • 1 / 2
                          • First post
                            Last post
                          Enjoying MagicMirror? Please consider a donation!
                          MagicMirror created by Michael Teeuw.
                          Forum managed by Sam, technical setup by Karsten.
                          This forum is using NodeBB as its core | Contributors
                          Contact | Privacy Policy