2
這可能是一個錯誤,因爲這是自升級Kendo庫以來的新行爲。我有Telerik的支持票。Kendo DropDownList在網格中首次點擊時打開並關閉
我有一個網格,其中一列使用客戶端模板,該模板定義了一個輸入元素,其類爲shipMethodDD。網格的數據綁定事件然後查找具有所述類的輸入元素。下拉開始就很好。問題是,用戶第一次點擊下拉菜單時,會打開並立即關閉。隨後的任何點擊都會打開它,並且會按預期保持打開狀態。我在同一頁面上的網格外部放置了一個輸入元素,它的行爲與預期相同。所以它是在網格中的問題。
@(Html.Kendo().Grid<Models.ShipmentPlanningLineModel>()
.Name("ShipmentPlanningOrders")
.Columns(col =>
{
col.Bound(c => c.Order.ShipMethod.Name).Title("Ship Method").Width(150)
.ClientTemplate("<inputclass='shipMethodDD'data-group='#= Order.Guid #'data-text-field='Name'data-value-field='Guid'data-bind='#= Order.ShipMethodGuid #'value='#= Order.ShipMethodGuid #'style='width:144px;'/>");
})
.Filterable()
.Scrollable(s => s.Height(600))
.Selectable(s => s.Mode(GridSelectionMode.Single))
.Sortable(s =>
{
s.SortMode(GridSortMode.MultipleColumn);
s.AllowUnsort(true);
})
.Navigatable()
.Resizable(r => r.Columns(true))
.DataSource(dataSource => dataSource
.Ajax()
.Read(r =>
{
r.Action("Planning", "Shipping");
r.Data("getShipmentPlanningParameters");
})
.ServerOperation(false)
.AutoSync(true)
.PageSize(25)
)
.Events(e =>
{
e.DataBound("gridBound");
})
)
functiongridBound(e)
{
vardataSource = newkendo.data.DataSource({
transport: {
read: {
url: location.href.substring(0, location.href.indexOf(':')) + '://'+ location.host + '/Shipping/GetShipMethods'
}
}
});
$('.shipMethodDD').each(function(idx, item)
{
$(item).kendoDropDownList({
dataTextField: "Name",
dataValueField: "Guid",
dataSource: dataSource,
value: $(item).val(),
autoBind: true,
change: function(e)
{
varshipMethodGuid = this.value();
varinput = $(this.wrapper).find('input');
$(input).val(shipMethodGuid);
vargroup = $(input).data('group');
updateShipMethod(group, shipMethodGuid);
}
});
});
kendo.ui.progress($('#ShipmentPlanningOrders'), false);
}