We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Tooltip Template ${if()}

Hi, I've been trying to get my conditions to work for the past hour, only to realise that the Sample is actually kind of "cheating".

My tooltip template contains this amongst others:
${if(Location !== null)}(tags removed) ${Location} ${/if}

If Location is in fact null, "null" is printed on the tooltip.

https://ej2.syncfusion.com/aspnetcore/Schedule/Tooltip#/material
In your sample, you have a similar condition, checking for "City". If set City to null for any of the appointments there, e.g. for "Server Maintenance" (document.getElementById("schedule").ej2_instances[0].eventsData[0].City = null), then it's actually the same. It only works because all of the items have the City property set.

Could you please advise whether your sample is wrong or this is bug?
Thanks!

1 Reply

NR Nevitha Ravi Syncfusion Team March 18, 2019 08:46 AM UTC

Hi Stefan, 

Greetings from Syncfusion Support. 

We have checked the reported scenario at our end and in the shared online demo link we have checked whether the City field is empty string(‘’) or undefined which is the cause for displaying null if we directly set null to the City field. To check null we need add the following highlighted code. 
<script id="toolTip" type="text/x-template"> 
        <div class="tooltip-wrap"> 
            <div class="image ${EventType}"></div> 
            <div class="content-area"> 
                <div class="name">${Subject}</></div> 
                ${if(City && City !== null && City !== undefined)}<div class="city">${City}</div>${/if} 
                <div class="time">From&nbsp;:&nbsp;${StartTime.toLocaleString()} </div> 
                <div class="time">To&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;${EndTime.toLocaleString()} </div> 
            </div> 
        </div> 
    </script> 

Kindly check the solution at your end and let us know if you need further assistance. 

Regards, 
Nevitha. 


Loader.
Up arrow icon