zhuguifei
2026-03-10 58402bd5e762361363a0f7d7907153c77dbb819f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/**
* jQuery EasyUI 1.3.6
* Copyright (c) 2009-2014 www.jeasyui.com. All rights reserved.
*
* Licensed under the GPL or commercial licenses
* To use it on other terms please contact author: info@jeasyui.com
* http://www.gnu.org/licenses/gpl.txt
* http://www.jeasyui.com/license_commercial.php
*
* jQuery EasyUI searchbox Extensions 1.0 beta
* jQuery EasyUI searchbox 组件扩展
* jeasyui.extensions.searchbox.js
* 二次开发 流云
* 最近更新:2014-05-05
*
* 依赖项:
*   1、jquery.jdirk.js v1.0 beta late
*   2、jeasyui.extensions.js v1.0 beta late
*   3、jeasyui.extensions.menu.js v1.0 beta late
*   4、jeasyui.extensions.linkbutton.js v1.0 beta late
*
* Copyright (c) 2013-2014 ChenJianwei personal All rights reserved.
* http://www.chenjianwei.org
*/
(function ($, undefined) {
 
    $.fn.searchbox.extensions = {};
 
 
    function initialize(target) {
        var state = $.data(target, "searchbox"), opts = state.options;
        if (!opts._initialized) {
            state.searchbox.find("input.searchbox-text").validatebox(opts);
            opts._initialized = true;
        }
    };
 
 
 
    var _destroy = $.fn.searchbox.methods.destroy;
    function destroy(target) {
        var t = $(target), textbox = t.searchbox("textbox");
        textbox.validatebox("destroy");
        _destroy.call(t, t);
    };
 
 
 
    var _searchbox = $.fn.searchbox;
    $.fn.searchbox = function (options, param) {
        if (typeof options == "string") {
            var method = $.fn.searchbox.methods[options];
            if (method) {
                return method(this, param);
            } else {
                return this.each(function () {
                    $(this).searchbox("textbox").validatebox(options, param);
                });
            }
        }
        options = options || {};
        return this.each(function () {
            var jq = $(this), hasInit = $.data(this, "searchbox") ? true : false,
                opts = hasInit ? options : $.extend({}, $.fn.validatebox.parseOptions(this), options);
            _searchbox.call(jq, opts);
            initialize(this);
        });
    };
    $.union($.fn.searchbox, _searchbox);
 
 
    var methods = $.fn.searchbox.extensions.methods = {
 
        destroy: function (jq) { return jq.each(function () { destroy(this); }); }
    };
    var defaults = $.fn.searchbox.extensions.defaults = {
    };
 
    $.extend($.fn.searchbox.defaults, defaults);
    $.extend($.fn.searchbox.methods, methods);
 
    if ($.fn.form && $.isArray($.fn.form.otherList)) {
        $.fn.form.otherList.push("searchbox");
        //$.array.insert($.fn.form.otherList, 0, "searchbox");
    }
 
 
    $.extend($.fn.datagrid.defaults.editors, {
        searchbox: {
            init: function (container, options) {
                var box = $("<input type=\"text\"></input>").appendTo(container).searchbox(options);
                box.searchbox("textbox").addClass("datagrid-editable-input");
                return box;
            },
            destroy: function (target) {
                $(target).searchbox("destroy");
            },
            getValue: function (target) {
                return $(target).searchbox("getValue");
            },
            setValue: function (target, value) {
                $(target).searchbox("setValue", value);
            },
            resize: function (target, width) {
                $(target).searchbox("resize", width);
            },
            setFocus: function (target) {
                $(target).searchbox("textbox").focus();
            }
        }
    });
 
 
})(jQuery);