fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.0 KiB

!(function () {
BI.Test = {};
_.extend(BI.Test, {
createWidget: function (widgetJson) {
var widget = BI.createWidget(BI.extend(widgetJson, {
root: true
}));
widget.element.appendTo("body");
return widget;
},
/**
* 模拟一次输入框的keydown事件
*/
triggerKeyDown: function (element, value, keyCode, callback) {
// keydown
var e = $.Event("keydown");
e.keyCode = keyCode;
element.trigger(e);
// input
BI.isNotNull(value) && element.val(value);
var e1 = $.Event("input");
e1.originalEvent = {};
e1.keyCode = keyCode;
element.trigger(e1);
// keyup 至少等300ms后触发
BI.delay(function () {
var e2 = jQuery.Event("keyup");
e2.keyCode = keyCode;
element.trigger(e2);
callback();
}, 300);
}
})
})();