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

Leading backslash breaks adding a new item

1 Answer 136 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 01 Mar 2017, 07:53 PM

Using
Kendo UI: 2016.3.1202
Chrome: 56.0.2924.87
Angular: 1.5.8
Implemented a dropdownlist as specified in https://demos.telerik.com/kendo-ui/dropdownlist/addnewitem with the exception of placing my addNew() in the Kendo template.

<script id="noDataTemplate" type="text/x-kendo-tmpl">
    <div>
        No data found. Do you want to add new item - '#: instance.filterInput.val() #' ?
    </div>
    <br />
    <button class="k-button" onClick="addNew('#: instance.element[0].id #', '#: encodeURI(instance.filterInput.val()) #');">Add new item</button>
    <script>

debugger

        function addNew(widgetId, value) {
    var widget = $("\\#" + widgetId).getKendoDropDownList();
            var dataSource = widget.dataSource;
            dataSource.add({
                categoryID: 0,
                categoryName: value
            });
            dataSource.one("sync", function() {
                widget.select(dataSource.view().length - 1); //
            });
            dataSource.sync();
        };
    </script>
</script>

 

While using the new "add new item" feature, if a user types in a leading back slash (e.g. \test ) the flow of the add new functionality breaks. I can add the 'test' to the widget but the UI never sets the selected value to test, just appears blank. Adding a 'debugger;' directly above datasource.one allows me to break within this code

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 02 Mar 2017, 08:30 AM
Hello Jason,

There are two duplicate threads submitted with the same subject (the current one and this one) in addition to an identical support ticket. If you have more questions on this subject I suggest we continue the discussion in the support ticket where I have already replied to your inquiry. A summary of the issue and its resolution can then be posted in the forum thread as it might helpful to the community.

Regards,
Ivan Danchev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
DropDownList
Asked by
Jason
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or