col1我一直在尝试根据几个建议将 jquery 自动完成编辑器添加到我的 SlickGrid (2.0) 中,但我一直收到错误消息:
对象不支持此属性或方法
这是我要开始的内容:
(function($) {
// register namespace
$.extend(true, window, {
"Slick": {
"Editors": {
"Auto": AutoCompleteEditor,
"SelectDD": SelectBoxEditor,
"Select": SelectBoxEditor2,
"Text": TextEditor,
"Text2": IntegerCellEditor
}
}
});
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
function AutoCompleteEditor(args) {
var $input;
var defaultValue;
var scope = this;
var calendarOpen = false;
this.init = function () {
$input = $("<INPUT id='tags' class='editor-text' />");
$input.appendTo(args.container);
$input.focus().select();
$input.autocomplete({
source: availableTags
});
};
this.destroy = function () {
$input.autocomplete("destroy");
};
this.focus = function () {
$input.focus();
};
this.loadValue = function (item) {
defaultValue = item[args.column.field];
$input.val(defaultValue);
$input[0].defaultValue = defaultValue;
$input.select();
};
this.serializeValue = function () {
return $input.val();
};
this.applyValue = function (item, state) {
item[args.column.field] = state;
};
this.isValueChanged = function () {
return (!($input.val() == "" && defaultValue == null)) && ($input.val() != defaultValue);
};
this.validate = function () {
return {
valid: true,
msg: null
};
};
this.init();
}
这是网格的相关部分:
var columns = [
{id:"col1", name:"test", field:"col1", width:135, editable:true, cssClass:"pad-4-left", sortable:true, editor:Slick.Editors.Auto},
我已经包括了所谓的依赖项:
<link rel="stylesheet" type="text/css" href="css/jquery-ui.css" media="all" />
<script type="text/javascript" src="js/jquery/jquery-1.8.3.js"></script>
<script type="text/javascript" src="js/jquery/jquery-ui.js"></script>
任何建议都会很棒。
谢谢