相关疑难解决方法(0)

Kendo UI AutoComplete数据源传输只读取一次

我对Kendo UI AutoComplete组件感到疯狂.我正在使用自己的函数来使用jQuery访问数据,因此我必须将AutoComplete dataSource.transport.read设置为函数.代码是这样的.

minLengthAtocomplete = 3;

$('#autocomplete').kendoAutoComplete({
    minLength : 3,
    filter : "contains",
    dataValueField : "key",
    dataTextField : "value",
    dataSource : new kendo.data.DataSource({
        transport : {
            read : _OnTransportRead
        },
        schema : {
            /* object schema */
        }
    })
});

function _OnTransportRead(e) {
    var text = $.trim(e.data.filter.filters[0].value);

    if (text && text.length >= minLengthAtocomplete) {
        _GetUsers(
            text,
            function onSuccess(data) {
                var users = [];
                 /* sets users with info in data */
                e.success(users);
            },
            function onError(error) {
                /* stuff with …
Run Code Online (Sandbox Code Playgroud)

datasource autocomplete transport kendo-ui

13
推荐指数
1
解决办法
1万
查看次数

标签 统计

autocomplete ×1

datasource ×1

kendo-ui ×1

transport ×1