Каскад выпадающего списка Kendo третьего уровня не показывает optionlabel

У меня есть три раскрывающихся списка кендо с каскадом, первый и второй верны, но третий не показывает метку параметра при загрузке страницы.

imageOfDropDownList

как вы можете видеть, выпадающий список «Ciudad» не показывает optionLabel, даже если он есть, как показано в консоли.

Я не знаю, почему это происходит, так как это то же самое, что и пример в демо-версиях кендо:

Ссылка на демонстрацию

вот код в бритве:

        <div class="baseControlsLine rowLineHeight lineMap">
            <div class="labelControlWith"> @Html.Label(@BackOffice.lblCountry + ":", htmlAttributes: new { @class = "baseLabel mapLabel" })</div>
            <div class="baseControlSmall">
                @(Html.Kendo().DropDownListFor(c => c.Customer.MapCountry)
                    .OptionLabel(BackOffice.txtSelectCountry)
                    .Events(e => e.Close("CustomerCreateEdit.CreateAddresMap").DataBound("CustomerCreateEdit.DataBound"))
                    .DataTextField("Text")
                    .DataValueField("Value").HtmlAttributes(new { @class = "baseTextbox" })
                    .DataSource(source => {
                        source.Read(read => {
                            read.Action(Constants.GET_COUNTRIES_SELECT_LIST, Constants.CUSTOMER_CONTROLLER);
                        });
                    }))
                @Html.ValidationMessageFor(model => model.Customer.MapCountry)
            </div>
        </div>
        <div class="baseControlsLine rowLineHeight lineMap">
            <div class="labelControlWith"> @Html.Label(@BackOffice.lblProvince + ":", htmlAttributes: new { @class = "baseLabel mapLabel" })</div>
            <div class="baseControlSmall">
                @(Html.Kendo().DropDownListFor(c => c.Customer.MapProvince)
                    .Events(e => e.Close("CustomerCreateEdit.CreateAddresMap"))
                    .OptionLabel(BackOffice.txtSelectProvince)
                    .DataTextField("Text")
                    .DataValueField("Value").HtmlAttributes(new { @class = "baseTextbox" })
                    .CascadeFrom("Customer_MapCountry")
                    .DataSource(source => {
                        source.Read(read => {
                            read.Action(Constants.GET_PROVINCES_SELECT_LIST, Constants.CUSTOMER_CONTROLLER).Data("CustomerCreateEdit.GetCountryId");
                        }).ServerFiltering(true);
                    }))
                @Html.ValidationMessageFor(model => model.Customer.MapProvince)
            </div>
        </div>
        <div class="baseControlsLine rowLineHeight lineMap">
            <div class="labelControlWith"> @Html.Label(@BackOffice.lblCity + ":", htmlAttributes: new { @class = "baseLabel mapLabel" })</div>
            <div class="baseControlSmall">
                @(Html.Kendo().DropDownListFor(c => c.Customer.MapCity)
                    .Events(e => e.Close("CustomerCreateEdit.CreateAddresMap"))
                    .OptionLabel(BackOffice.txtSelectCity)
                    .DataTextField("Text")
                    .DataValueField("Value").HtmlAttributes(new { @class = "baseTextbox" })
                    .CascadeFrom("Customer_MapProvince")
                    .DataSource(source => {
                        source.Read(read => {
                            read.Action(Constants.GET_CITIES_SELECT_LIST, Constants.CUSTOMER_CONTROLLER).Data("CustomerCreateEdit.GetProvinceId");
                        }).ServerFiltering(true);
                    }))
                @Html.ValidationMessageFor(model => model.Customer.MapCity)
            </div>
        </div>

здесь код javascript:

    GetCountryId: function () {
    /// <signature>
    ///   <summary>Devuelve el id del country para la cascada.</summary>
    /// </signature>
    return {
        id: $("#Customer_MapCountry").val()
    };
},
GetProvinceId: function () {
    /// <signature>
    ///   <summary>Devuelve el id de la provincia para la cascada.</summary>
    /// </signature>
    return {
        id: $("#Customer_MapProvince").val()
    };
},

а вот контроллеры:

    public JsonResult GetCitiesSelectList(int? id) {
        if (!id.HasValue)
            return Json(new SelectListItem() { Text = BackOffice.txtSelectCity }, JsonRequestBehavior.AllowGet);
        List<CityLanguage> listCity = _applicationCity.GetAllWithLanguage(id.Value).ToList();
        return Json(new SelectList(listCity, "IdCity", "Name"), JsonRequestBehavior.AllowGet);
    }
    public JsonResult GetProvincesSelectList(int? id) {
        if (!id.HasValue)
            return Json(new SelectListItem() { Text = BackOffice.txtSelectProvince }, JsonRequestBehavior.AllowGet);
        List<ProvinceLanguage> listProvince = _applicationProvince.GetAllWithLanguage(id.Value).ToList();
        return Json(new SelectList(listProvince, "IdProvince", "Name"), JsonRequestBehavior.AllowGet);
    }
    public JsonResult GetCountriesSelectList() {
        List<CountryLanguage> listCountryLanguage = _applicationCountry.GetAllWithLanguage().ToList();
        return Json(new SelectList(listCountryLanguage, "IdCountry", "Name"), JsonRequestBehavior.AllowGet);
    }

Изменить:

У меня были проблемы с версией jquery, и мне пришлось поставить javascripts в таком порядке:

jquery. кендо. jquery-интерфейс.

возможно, ошибка связана с порядком javascripts?

Также у меня есть версия jquery, которая не входит в состав кендо.

Возможно, некоторые из этих вещей вызывают странное поведение третьего раскрывающегося списка?


person Albert Cortada    schedule 12.02.2014    source источник
comment
покажите код раскрывающегося списка, чтобы мы могли вам помочь.   -  person Jaimin    schedule 12.02.2014
comment
я отредактировал вопрос, спасибо.   -  person Albert Cortada    schedule 12.02.2014


Ответы (1)


Привет, попробуй с Placeholder вместо OptionLabel.

 @(Html.Kendo().DropDownListFor(c => c.Customer.MapCountry)
                    .Placeholder(BackOffice.txtSelectCountry)
                    .Events(e => e.Close("CustomerCreateEdit.CreateAddresMap").DataBound("CustomerCreateEdit.DataBound"))
                    .DataTextField("Text")
                    .DataValueField("Value").HtmlAttributes(new { @class = "baseTextbox" })
                    .DataSource(source => {
                        source.Read(read => {
                            read.Action(Constants.GET_COUNTRIES_SELECT_LIST, Constants.CUSTOMER_CONTROLLER);
                        });
                    }))
person Jaimin    schedule 12.02.2014
comment
Привет, Джаймин, извини, но у меня нет опции «Заполнитель» в моей версии кендо, и я думаю, что у меня есть последняя. - person Albert Cortada; 12.02.2014
comment
@AlbertCortada хорошо, тогда я должен проверить. - person Jaimin; 12.02.2014