Read the statement by Michael Teeuw here.
Cal EXT3 - understanding transforming
-
Hello again guys
I am using the 3rd cal-mod from @MMRIZE and try to bring it up a bit more specific regarding styling.
So the documention says:
Transforming
You can manipulate or change the properties of the event.eventTransformer: (ev) => { if (ev.title.search("John") > -1) ev.color = "blue"; return ev; };
This example shows how you can transform the color of events when the event title has specific text.
Would this mean, it looks up, if the events text is exact like the named text ( “John” in this example )
OR the event starts with the word
OR the event contains this word?Also I wondered, if I can specify the icon used for this event, besides defining the events color?
Thank you very much and as always, regards from Germany -
@_V_ said in Cal EXT3 - understanding transforming:
ev.title.search
search() searches the string for the specified characters and IF those characters are found, it returns the position of the text in the string…(0= 1st char/start of string). if NOT found it returns -1
this is a javascript string function
there is also startsWith() and endsWith()
search() = containsthe code could have used includes()
The includes() method of String values performs a case-sensitive search to determine whether a given string may be found within this string, returning true or false as appropriate.
if you wanted case insensitive, you would do
ev.title.toLowerCase().includes(‘john’) -
@_V_ transforming, you must ALWAYS return the event, modified or not