【问题标题】:Kendo combo box retrive selected item with virtual剑道组合框用虚拟检索选定的项目
【发布时间】:2016-08-10 18:52:07
【问题描述】:

我有一个启用了虚拟功能的剑道组合框,我想检索选定的项目,因为之后我需要更多信息。

在一些虚拟加载后选择项目时,我得到了未定义。

这是我的代码

$scope.select_item_options = {
        dataValueField: "id",
        dataTextField: "description_nhl",
        template: "#= description #",
        virtual: true,
        filter: "contains",
        change: function(e) {
            var selected_index = this.selectedIndex;
            if (selected_index < 0) {
                delete $scope.work_item.item_id;
            } else {
                var item = this.dataItem(this.select());
                console.log(item);
                console.log(this.dataItem(selected_index));
                // undefined here
            }
            $scope.$apply();
        },
        dataSource: new kendo.data.DataSource({
            transport: {
                read: {
                    type: "GET",
                    url: APP_CONFIG.api.base_url + "/items/itemTypes/AC",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    beforeSend: function(xhr) {
                        xhr.setRequestHeader('Authorization', storageService.getValue('auth_token'));
                    },
                    complete: function(result, status) {
                        if (result.status !== 200 || !result.responseJSON.fn.result.done) {
                            return httpService.callbackOnError(result.responseJSON, result.status);
                        }
                    }
                }
            },
            schema: {
                data: 'data',
                total: function(data) {
                    return data.dataCount;
                }
            },
            serverPaging: true,
            serverSorting: true,
            serverFiltering: true,
            pageSize: 5,
            sort: {field: "description", dir: "asc"}
        })
    };

【问题讨论】:

  • 我使用 this.dataItem() 没有参数,似乎正在工作,我正在测试

标签: javascript kendo-ui kendo-combobox


【解决方案1】:

解决变化

var item = this.dataItem(this.select());

var item = this.dataItem();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-30
    • 1970-01-01
    • 2013-05-21
    • 1970-01-01
    相关资源
    最近更新 更多