如何在kendo UI模板中检查字符串是否包含逗号

问题描述 投票:0回答:1

在kendo UI模板中,我要检查字符串是否包含逗号(',')分开的值

<script id="supply-chain-manager-column-template" type="text/x-kendo-template">

    # if (UserRole != null) { #
        # if (UserRole.indexOf(',')>-1) != null) { #
    <span>#= UserRole # ...</span>
    # }  else { #
    <span>#= UserRole # ... </span>
    # } #

</script>
c# kendo-ui kendo-grid
1个回答
0
投票

[这项为我工作

<script id="account-relationship-manager-column-template-load-management" type="text/x-kendo-template">
    # if (UserRole != null) { #
    # if (parseInt(UserRole.indexOf(',')) > 0) {#
    <a href="\#" data-bind="events: { click: onUserRoleClick }"> #= UserRole.split(',')[0] # .... </a>
    # } else { #
    <span>#= UserRole #  </span>
    # } #
    # } #
</script>
© www.soinside.com 2019 - 2024. All rights reserved.