0
2つ以上の値を含む剣道コンボボックスがある場合は、「-ALL-をDataTextFieldとして、「9999」をDataValueFieldとして挿入したいと思います。単一のレコード私はDataBoundイベントを使ってそれをテストし、それが1ならばこの値に基づいてグリッドを読み込みますが、長さが1より大きい場合は-All-を追加したいと思います。 telerikによって記載されるように挿入する。次いで剣道コンボボックスに値を挿入する方法
@(Html.Kendo().ComboBox()
.Name("FAList")
.Placeholder("Select Fiscal Agency...")
.DataTextField("Text")
.DataValueField("Value")
.HtmlAttributes(new { style = "width:50%;" })
.Filter("startswith")
.AutoBind(true)
.MinLength(3)
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetUserAgencyList", "Entities");
})
.ServerFiltering(true);
})
.Events(e => e
.Change("onFAChange")
.DataBound("onFADataBound")
)
)
及び機能を
function onFADataBound(e) {
// the agency list dropdown
var combobox = $("#FAList").data("kendoComboBox");
// if there is only a single record then set that in the combobox and load the grid based on that
if (e.sender.dataSource.view().length == 1) {
e.sender.select(0);
var filter = this.value();
$.get('/City/CityGrid_Read', { id: filter }, function (data) {
var grid = $("#FollowUpGrid").data("kendoGrid");
grid.dataSource.read();
})
}
if (e.sender.dataSource.view().length > 1) {
}
}
私は上記の提案を試してみました未定義のリストを得たので、私は挿入を試み、未定義のリストを再度得ました。 –
新しいコード行でTextとValueを大文字にしてみてください。私の他の考えは、データソースに追加する行を実行した後、コンボボックスでデータソースバインドメソッドを呼び出して、新しく追加されたデータソースオブジェクトに再バインドするようにしますか?あなたはそれが働くことを望む! –