This is a migrated thread and some comments may be shown as answers.

Uncaught TypeError: Cannot read property 'replace' of undefined

1 Answer 664 Views
Templates
This is a migrated thread and some comments may be shown as answers.
Adeeb
Top achievements
Rank 1
Adeeb asked on 12 Dec 2014, 05:52 PM
I keep getting this error. The template names matches. Can you please look intog this

<body>


 Please select factories from available factories list:

<table>
<tr><th>Available factories</th><th>         </th><th>Selected factories</th></tr><th>         </th>
<tr>
<td><div id="listA"></div></td>
<td><button id='right'> Add</button></td>

<td>
<script id="listBTemplate" type="text/x-kendo-template">

# if (packout === false){#
<div class='item'> #: name #  
<label class='chkbox'> <input  id=#=uid#  type='checkbox' onClick='packout(this.id)'> 
packout? 
</label>
</div>
# }else if(packout === true) { #
<div class='item'> #: name #  
<label class='chkbox'> <input  id=#=uid#  type='checkbox' onClick='packout(this.id)'  checked>
packout? 
</label>
</div>
#}#

</script>
<div id="listB"></div>
</td>

<td><button id='left'>Remove</button></td>
</tr>
<tr>
<td><button id="saveButton">Save</button></td>
<td><button id="cancelButton">Close</button></td>
</tr>
</table>


<style>
    #listA, #listB {
width: 400px;
        height: 600px;
overflow: auto;
        float: left;
        margin-right: 30px;
        border: 3px solid black;
        border-radius: 3px;
    }

    .item {
        margin: 5px;
        padding: 5px;
        text-align: left;
        border: 2px solid #ccc;
        border-radius: 5px;
    }
    .chkbox{
float:right;
     }
</style>
</body>
</html>
//Javascript snippet causing the issue:
  var _listB = $("#listB").kendoListView({
        dataSource: [],//listB_DS
template: kendo.template($("#listBTemplate").html()),
selectable: "multiple"
    }).data("kendoListView");

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 13 Dec 2014, 01:03 PM
Hello Adeeb,

I tried to reproduce the issue based on your code, and it does not result in the error you describe. Perhaps I am missing something?

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Templates
Asked by
Adeeb
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or