sitefinitysteve
Top achievements
Rank 2
Iron
Iron
Veteran
sitefinitysteve
asked on 20 Sep 2011, 08:24 PM
Ok so here's the code I'm using from the demos page
...idea being I'd change the DS once I saw it working...but inspecting with firebug I see not ajax requests firing and I get no autocomplete.
What am I missing?
Here's the fiddle: http://jsfiddle.net/stevescotthome/S95xC/
(notice the attached kendo version is the custom one you sent me)
//SEARCH BOX $("#search-box").kendoAutoComplete({ minLength: 3, dataTextField: "Name", //JSON property name to use dataSoruce: new kendo.data.DataSource({ type: "odata", //Specifies data protocol pageSize: 10, //Limits result set transport: { } }) });...idea being I'd change the DS once I saw it working...but inspecting with firebug I see not ajax requests firing and I get no autocomplete.
What am I missing?
Here's the fiddle: http://jsfiddle.net/stevescotthome/S95xC/
(notice the attached kendo version is the custom one you sent me)
4 Answers, 1 is accepted
0
Hello Steve,
Here is the updated jsFiddle demo.
Greetings,
Georgi Krustev
the Telerik team
You have a typo in the declaration:
dataSoruce: new kendo.data.DataSource({ //should be dataSourceHere is the updated jsFiddle demo.
Greetings,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
sitefinitysteve
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 21 Sep 2011, 09:50 AM
Oh geez look at that...yeah actually this is a direct cut paste from the demos page which also seems o have the typo
0
sitefinitysteve
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 21 Sep 2011, 05:50 PM
Ok so this is my new version:
Seems to properly send up the GET...but it's not sending over the callback variable for JSONP so I can return the wrapped data...
Here are the params being sent
So the error is
freemarker.core.InvalidReferenceException: Expression callback is undefined on line 1, column 3 in org\/alfresco\/medportal\/media\/autocomplete.get.json.ftl."
Since the json converter is trying to wrap the result in the callback variable (this is an alfresco webscript json template)
So how do I get the callback sent?
$("#search-box").kendoAutoComplete({ minLength: 3, filter: "contains", dataTextField: "Name", dataValueField: "Id", dataSource: new kendo.data.DataSource({ type: "jsonp", severFiltering: false, serverPaging: false, pageSize: 5, transport: { read: { url: alfresco.BaseURL + "/alfresco/service/medportal/autocomplete", data: { alf_ticket: alfresco.Ticket, format: "json" } } } }) });Seems to properly send up the GET...but it's not sending over the callback variable for JSONP so I can return the wrapped data...
Here are the params being sent
| alf_ticket | TICKET_a1a32dc9735055eed53859a05564120f10c00563 |
| filter[0][field] | Name |
| filter[0][operator] | contains |
| filter[0][value] | mik |
| format | json |
| page | 1 |
| pageSize | 5 |
| skip | 0 |
| take | 5 |
So the error is
freemarker.core.InvalidReferenceException: Expression callback is undefined on line 1, column 3 in org\/alfresco\/medportal\/media\/autocomplete.get.json.ftl."
Since the json converter is trying to wrap the result in the callback variable (this is an alfresco webscript json template)
${callback}( { "ticket" : "${session.ticket}", "mediaitems": [<#list mediajson as media> { "title": "${media.title}" }<#if media_has_next>,</#if> </#list>] })So how do I get the callback sent?
0
Hi Steve,
The settings of the transport are passed to the $.ajax method. You can check the "Binding to remote data" online demo for a working implementation.
Regards,
Atanas Korchev
the Telerik team
Try this instead:
transport: { read: {
dataType: "jsonp", url: alfresco.BaseURL +"/alfresco/service/medportal/autocomplete", data: { alf_ticket: alfresco.Ticket, format: "json" } } }Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!