1

I am using Kendo UI to implement a couple of comboboxes on my page. The second combobox relies on the value of the first to populate, but I do not want to use the "Cascade" option, since the second combobox should not ever be disabled.

My issue is the following:
On change of combobox A, combobox B should populate with appropriate values in its dropdown, but the box itself should be clear. I clear the text and value of Combobox B, but when I run a datasource Read or anything, the combobox is refilled with old text.

Subentity is Combobox B:

    var subentity = $('#subentity').getKendoComboBox();

    $("#subentity").val(null);
    subentity.value(null);

    subentity.dataSource.data({});

    subentity.text('');

I have tried several options, and moving where the values are cleared around, and can't seem to get it to work.

Any ideas? Thank you!

EDIT: Combobox B (subentity) is initialized as follows:

$("#subentity").kendoComboBox({
    placeholder: "--- Enter a Sub-Entity ---",
    autoBind: false,
    animation: false,
    dataSource: {
        type: "json",
        serverFiltering: true,
        transport: {
            read: {
                url: ResolveUrl('~/Entity/GetSubentities')
            },
            parameterMap: function () {
                return {
                    entityId: $('#hdnEntityId').val(),
                    subentityName: $("#subentity").data("kendoComboBox").text()
                }
            }
        }
    },
    dataTextField: "Name",
    dataValueField: "Id",
    delay: 500,
    change: onChangeOfSubentityCombo,
    filter: "contains",
    suggest: true,
    value: $('#hdnSubentityName').val()
});
4

1 回答 1

1

我认为您的价值正在被这条线所取代。

value: $('#hdnSubentityName').val()

将其更改为

value:""

这将导致您的“--- Enter a Sub-Entity ---”字段显示,但是,您也可以将占位符设置为空白。

placeholder: ""
于 2014-07-02T03:14:10.743 回答