kendo UI DropDownList表现得很奇怪

时间:2013-05-21 19:18:33

标签: html5 kendo-ui html-select

我有以下代码。在获取所选值时,它可以正常工作。但是,如果我尝试将所选值置于任何条件下,它就会动摇。代码崩溃。

var onAcctMgrSelect = function (e) {
    // access the selected item via e.item (jQuery object)
    ddAMList = $("#ddAM").data("kendoDropDownList");
    if (ddAMList.value() == "0")
        $("#btnSearch").attr("class", "k-button  k-state-disabled");
    else
        $("#btnSearch").attr("class", "k-button");
    ///alert(ddAMList.text()); 
    checkValidData();
};

DropDownlist代码如下:

function loadAccountManagers() {
    $("#ddAM").kendoDropDownList({
        change: onAcctMgrSelect,
        dataTextField: "AcctMgrFullName",
        dataValueField: "Id",
        dataSource: {
                schema: {
                    data: "d", // svc services return JSON in the following format { "d": <result> }. Specify how to get the result.
                    total: "count",
                    model: { // define the model of the data source. Required for validation and property types.
                        id: "Id",
                            fields: {
                                Id: { validation: { required: true }, type: "int" },
                                    AcctMgrFullName: { type: "string", validation: { required: true} }
                                    }
                           }
                        },
                transport: {
                read: {
                    url: "../services/Prospects.svc/GetAccountManagers", //specify the URL which data should return the records. This is the Read method of the Products.svc service.
                    contentType: "application/json; charset=utf-8", // tells the web service to serialize JSON
                    type: "GET" //use HTTP POST request as the default GET is not allowed for svc
                }
            }
        }
    });

如果选择了第一项,我基本上会尝试禁用提交按钮(在我的情况下,这是一个空白项,值为'0')。

我在哪里出错了?请帮忙!

0 个答案:

没有答案