简体   繁体   中英

Kendo Template - Convert boolean value into yes or no

I have this kendo template and i am trying to convert the isDiscount boolean value into yes/no. Please suggest how can i perform this conversion.

 <script type="text/x-kendo-template" id="template">
            <div id="details-container">
                <h2>#= Name # </h2>
                <em>#= Description #</em>
                <dl>
                  <dt>Price: #= kendo.toString(Price, "c")#</dt>                
                  <dt>Discount available: #= isDiscount #</dt>
                </dl>
            </div>
      </script>

You can use the conditional conversion inline like that:

<dt>Discount available: #if(isDiscount){# Yes#} else {# No#}#</dt>

There is also a demo here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM