2
當使用編輯器網格並且我的按鈕在底部放置新行時,驗證消息被網格隱藏。
我已經在這裏建立了一個例子:http://jsfiddle.net/api2304/K54v3/1/Kendo Grid - 驗證消息不會在網格中的自定義編輯器上顯示
- 點擊一個按鈕添加
- 離開細胞名稱爲空,然後按Tab。
- 該消息將顯示在該行下方。
HTML:
<div id="grid"></div>
的Javascript:
var _dsGrid;
var _grid;
var _this = this;
_this._dsGrid = new kendo.data.DataSource({
autoSync: true,
data: [{ Cod: 0, Name: 'Value0' },
{ Cod: 1, Name: 'Value1' }],
schema: {
model: {
fields: {
Cod: { editable: false },
Name: {
validation: {
required: true,
required: { message: "Custom message" }
}
}
}
}
}
});
_this._grid = $("#grid").kendoGrid({
columns: [
{ field: "Cod" },
{ field: "Name" }
],
selectable: true,
dataSource: _this._dsGrid,
editable: true,
toolbar: [
{ template: kendo.template("<a id='btnAdicionar' class='k-button k-button-icontext'><span class='k-icon k-add'></span>Adicionar</a>") }
],
edit: function(e) {
e.container.find("input[name='Nome']").attr('maxlength', '20');
e.container.find("input").bind("blur", function() {
$("#grid").scrollTop($("#grid")[0].scrollHeight + 200);
});
}
}).
data("kendoGrid");
$("#btnAdicionar").click(function() {
var total = _this._dsGrid.data().length;
var insert = _this._dsGrid.insert(total, {});
_this._dsGrid.page(_this._dsGrid.totalPages());
var ultimoId = _this._dsGrid.data()[total - 1].Nivel;
_this._grid.editRow(_this._grid.tbody.children().last());
});
我在這裏找到解決方案: http://www.telerik.com/forums/hidden-validators-when-virtual-scrolling-createat-bottom –
如果問題得到解決,您應該自己提供答案,並將其標記爲接受的答案 – Joram