您好,登录后才能下订单哦!
1、kendo在表格(grid)编辑中验证提示的信息是字段名为英文,如何变成中文
设置在此:
schema: {
model: {
id: "ID",
fields: {
ID: { editable: false, nullable: true },
Name: { validation: { required:{message:"答案必须录入" }} ,nullable: false}
}
}
将required:true变为required:{message:"答案必须录入" }即可!
2、kendo类似msgbox,confirm对话框
kendo自身没有,只有重写。利用kendo的风格色彩。
(function (kendo) {
kendo.message = function (newMessage, option) {
var $ = kendo.jQuery;
var _kendoMessage = kendo['_kendoMessage'];
var _kendoMessageDom = kendo['_kendoMessageDom'];
var defaultOption = {
width: "400px", height: "150px", title: "消息", actions: ["Close"], modal: true,
button: { text: '  确定  ', callback: function (kendoMessage) { kendoMessage.close(); } }
};
$.extend(defaultOption, option);
if (_kendoMessage) {
_kendoMessageDom.children("#msg").html(newMessage);
_kendoMessage.center();
_kendoMessage.open();
} else {
var html = '<div><div id="msg" >' + newMessage + '</div>' +
'<div class="k-edit-buttons k-state-default k-window-action" >' +
'<a href="#" class="k-button">' + defaultOption.button.text + '</a></div></div>';
_kendoMessageDom = $(html);
_kendoMessageDom.kendoWindow(defaultOption);
_kendoMessage = _kendoMessageDom.data("kendoWindow");
_kendoMessage.center();
_kendoMessage.open();
_kendoMessageDom.find("a").click(function () { defaultOption.button.callback(_kendoMessage); });
kendo['_kendoMessage'] = _kendoMessage;
kendo['_kendoMessageDom'] = _kendoMessageDom;
}
},
kendo.confirm = function (newConfirm, option,fun,funno) {
var $ = kendo.jQuery;
var _kendoConfirm = kendo['_kendoConfirm'];
var _kendoConfirmDom = kendo['_kendoConfirmDom'];
var defaultOption = {
width: "400px",
height: "150px",
title: "删除确认",
resizable: false,
actions: [
"Close"
],
modal: true,
ok: {
text: '  确定  ',
callback: function (f, kendoConfirm)
{
if (f && typeof (f) == "function") { f() };
kendoConfirm.close()
}
},
cancel: {
text: '  取消  ',
callback: function (n, kendoConfirm) {
if (n && typeof (n) == "function") { n() };
kendoConfirm.close()
}
}
};
$.extend(true, {}, defaultOption, option);
if (_kendoConfirm) {
_kendoConfirmDom.children("#msg").html(newConfirm);
_kendoConfirm.center();
_kendoConfirm.open();
} else {
var html = '<div><div id="msg" >' + newConfirm + '</div>' +
'<div class="k-edit-buttons k-state-default k-window-action" >' +
'<a href="#" class="k-button" id="confirmOk" >' + defaultOption.ok.text + '</a>' +
'<a href="#" class="k-button" id="confirmCancel">' + defaultOption.cancel.text + '</a></div></div>';
_kendoConfirmDom = $(html);
_kendoConfirmDom.kendoWindow(defaultOption);
_kendoConfirm = _kendoConfirmDom.data("kendoWindow");
_kendoConfirm.center();
_kendoConfirm.open();
_kendoConfirmDom.find("#confirmOk").click(function () { defaultOption.ok.callback(fun,_kendoConfirm); });
_kendoConfirmDom.find("#confirmCancel").click(function () { defaultOption.cancel.callback(funno,_kendoConfirm); });
kendo['_kendoConfirm'] = _kendoConfirm;
kendo['_kendoConfirmDom'] = _kendoConfirmDom;
}
}
})(kendo);
用法: kendo.confirm("是否确认删除?",{},function(){
按确定键},function(){按取消键}
});
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。