Telerik Forums
Kendo UI for jQuery Forum
1 answer
174 views

Hi,

I have following code:

01.var arrlistNamaKaryawan;
02.
03.google.script.run.withSuccessHandler(populateNamaKaryawan).getNamaKaryawanReceived();
04.   
05.var dataSource = new kendo.data.DataSource({data : arrlistNamaKaryawan});      
06.   
07.// create a new widget instance
08.$("#employee").kendoAutoComplete({ dataSource: dataSource });
09.   
10. // retrieve the widget instance
11. var empAutoComplete = $("#employee").getKendoAutoComplete();
12.
13.function populateNamaKaryawan(listNamaKaryawan){
14.   console.log(listNamaKaryawan);
15.   console.log(Object.keys(listNamaKaryawan));
16.   console.log(Object.values(listNamaKaryawan));
17.   console.log(Object.entries(listNamaKaryawan));
18.    console.log(arrAnimal);

 

19.   arrlistNamaKaryawan = Object.keys(listNamaKaryawan);
20.   //arrlistNamaKaryawan = listNamaKaryawan;
21.}
22.
23.function getNamaKaryawanReceived(){
24.    var ss = SpreadsheetApp.openByUrl(urlStockBarangIT);
25.    var ws = ss.getSheetByName("Master Karyawan");
26.    var data = ws.getRange(2, 2, 3, 1).getValues();
27.
28.    var options = {};
29.    data.forEach(function(v){
30.         options[v[0]] = null; //convert to object
31.    });
32.
33.    console.log(options);
34.    return options;
35.
36.    //console.log(data);
37.    //return data;
38.}

 

But my #employee AutoComplete still no data

Thank you

Neli
Telerik team
 answered on 23 Jul 2020
12 answers
794 views

Recent Kendo update added noDataTemplate shows when there is no search result.

Is there way that make it not display in default?

Ivan Danchev
Telerik team
 answered on 24 Jun 2020
1 answer
270 views

Need your help Looking for a jQuery example of how to pass authToken and bind autocomplete to https://graph.microsoft.com/v1.0/me/people/?$search=(?)

Ivan Danchev
Telerik team
 answered on 12 May 2020
2 answers
1.0K+ views

Do we have any feature for below requirement please confirm..

Initially will load like 10 items (we have around 100+ items )
and then as we scroll through the 10 items and come to the end, will automatically load 10 more items

kudaravalli
Top achievements
Rank 1
 answered on 17 Mar 2020
1 answer
201 views
How to add a button in nodatatemplate of autocomplete widget in MVC. Sample screenshot is attached.
Martin
Telerik team
 answered on 03 Feb 2020
3 answers
96 views

Background

I have a Kendo autocomplete that should display a list of "recently searches" on focus. To accomplish this, I wired up a focus event, where I autocomplete.search(''). This reliably displays the default list (whole list on local datasource and whatever my server returns on empty string with a remote datasource). However, we also wish to enable the suggest option, so upon focus, the autocomplete empty searches, and suggests the first option.

IE 11 Issue
This is where the first issue occurs. On IE11, our first search is triggered, and does as anticipated (shows list, and suggests the first option). However, a second search is also fired, but uses the suggestion as the search criteria.

This can be demonstrated in an isolated Dojo: https://dojo.telerik.com/ekIXopar by selecting the autocomplete input.

 

All Browsers Issue - Search Triggered by Modifier Keys

On all browsers, even non-IE11, pressing modifer keys (eg: ctrl, shift, caps-lock, etc...) will immediately trigger a search with whatever is in the textbox (including suggestions). This causes issues when combined with the suggest is true. The real-world use case for this was having our users go to paste in something:

1. The focus search and suggest fills in the textbox with the first search result
2. The user presses ctrl in preparation to ctrl-v paste.
3. Between ctrl and v, the autocomplete will trigger another search with the now suggested text as criteria, thus narrowing the result to only the 1, AND offsetting the selection by 1 at the start of the text (ie: all but the first letter is highlighted).
4. When the user finishes the paste, the result is the first letter of the original suggestion and whatever they pasted.

This can also be demonstrated in the above dojo. Simply select the input and press and release the ctrl button. You should immediately see the first character get unselected, and "Albania" should become the only auto-suggestion result.

Possible Causes

Digging into the Kendo AutoComplete source, the keydown listener is picking up the control key as it's own keydown. From here, we have some if/elses that perform certain logic such as moving the selection up/down. However, our example of ctrl (keycode 17), falls into the else logic, which triggers a search based on the input value.

Possible Solutions

1. If I put the focus listener before the autocomplete call, I remove the initial issue... however, the fundamental issue with modifier keys triggering searches remains. This is problematic as pressing control (and other modifier keys), imho, shouldn't directly change the user's search results.

2. Add additional listeners to filter our these keys before the kendo autocomplete init, and stop the events from getting to kendo (stopImmediatePropagation). May introduce some other issues...

Question

Is there a solution to the IE11 bug? And for modifier searches, is there better work-arounds, or is this something that Kendo could address in an update?

Martin
Telerik team
 answered on 09 Jan 2020
1 answer
580 views

Hello,

is there a way to trim search value in autocomplete? The scenario is that as first thing when I use autocomplete I press space, to see all values on list, and then if there are many I start to type search value, however initial space is not trimed, so search result is not accurate.

 

Petar
Telerik team
 answered on 16 May 2019
3 answers
668 views

I am using kendo grid column editor to get autocomplete values in each cell in a column.

If my selected text is digit, then its selecting [object Object] for the first time and after that if I select again different digit, it will select the digit.

And it doesn't happens with the alphabet/alphanumeric text values.

In the below code, If I am selecting "50", it is giving [object Object].

And if I am selecting Test 65/ Test, it will not change.

And if I add space in text ("50 "), them this value will also not change.

please check and resolve the issue.

 

$('<input data-text-field="text" data-value-field="value" data-bind="value:' + options.field + '"/>')
            .appendTo(container)
            .kendoAutoComplete({
                autoBind: false,
                suggest: true,
                filter: "contains",
                index: 1,
                minLength: 1,
                dataSource: [
                    { text: "50", value: "50"},
                    { text: "60", value: "60" },
                    { text: "Test 65", value: "65" },
                    { text: "Test", value: "23" },
                    { text: "64", value: "64" },
                    { text: "20", value: "20" }
                ]
            });

Dimitar
Telerik team
 answered on 14 Mar 2019
3 answers
290 views

I have need to create kendo auto completes dynamically, where each one could potentially have thousands of records... Thus, I am wanting to call my controller, get data from a Salesforce database based on the current search, then reset the dataSource of the auto complete with returned data in the filtering event.

 

My code is: 

if(fieldMap[i].fieldType == 'REFERENCE'){
                      extraString = '<div class="k-edit-label"><label for="'+fieldMap[i].fieldName+'Input">'+fieldMap[i].fieldLabel+'</label></div><div data-container-for="'+fieldMap[i].fieldName+'Input" class="k-edit-field" id="'+fieldMap[i].fieldName+'Container">';
                            dynamicComponent = '<select id="'+fieldMap[i].fieldName+'Input" type="text" data-role="dropdownlist" style="width: 150px">';
                            optString = '';
                            for(var k = 0; k < fieldMap[i].referenceList.length; k++){
                                if(k == 0){
                                optString += '<option value="'+fieldMap[i].referenceList[k]+'" selected>'+fieldMap[i].referenceList[k]+'</option>';   
                                } else{
                                optString += '<option value="'+fieldMap[i].referenceList[k]+'">'+fieldMap[i].referenceList[k]+'</option>';   
                            }
                            }
                            optString += '</select>';
                            var inputString = '<input data-role="autocomplete" data-filter="contains" data-source="testData" id="'+fieldMap[i].fieldName+'SearchInput"/></div>';
                            dynamicComponent = dynamicComponent + optString + inputString;
                            
                        }
                    
                    extraString += dynamicComponent;
                        //editorTemplateString += extraString;
                    $('#editor_template').append(extraString);
                        extraString = '';
                        dynamicComponent = '';
                        if(fieldMap[i].fieldType == 'REFERENCE'){
                            kendo.init($('#'+fieldMap[i].fieldName+'SearchInput'));
                            var autoComp = $('#'+fieldMap[i].fieldName+'SearchInput').data('kendoAutoComplete');
                            autoComp.bind('filtering', autoComplete_filter);
                            console.log($('#'+fieldMap[i].fieldName+'SearchInput').data('kendoAutoComplete'));
                            
                        }
                    }

 

which seemingly seems to successfully create kendo auto complete widgets with dummy data in testData right now. However, autoComplete_filter method is never being called when I type in the box. That method is simply:

function autoComplete_filter(e){
                console.log(e);   
                }

right now... but nothing prints out in the console when I type in the auto complete box.

How do I set the filtering event on dynamically created auto completes like this? Also, how can I set the minLength to three? It starts filtering after the first character entered and I only want it to start after 3 or more are entered.

 

Thank you for any help.

Plamen
Telerik team
 answered on 15 Feb 2019
14 answers
1.7K+ views
Hi,

Sorry if this question is completely silly, as JavaScript is not my stronger point. I use the autocompleter to fetch cities stored in my database. What I show is the name of the city, however what I want to get when I submit my form is the id of the city, not the name. Therefore, each request returns a JSON answer with the name and the id, and I use dataTextField: "name" so that the autocompleter extracts the name. However, in some of your example (like this one : http://demos.kendoui.com/autocomplete/remotedatasource.html) you are using DataValueField, so I thought that DataValueField: "id" would work. However it doesn't. Furthermore, it appears that DataValueField is not in the documentation of available options fields (http://demos.kendoui.com/autocomplete/remotedatasource.html).
Timothy
Top achievements
Rank 1
 answered on 03 Dec 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?