EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Vladzimir on November 23, 2025, 10:20:45 AM



Title: BUG tagbox in datagridfilter
Post by: Vladzimir on November 23, 2025, 10:20:45 AM
I use
Code:
    $.extend($.fn.datagrid.defaults.filters, {
        tagbox: {
            init: function (container, options) {
                var input = $('<input>').appendTo(container);
                input.tagbox($.extend({
                    selectOnNavigation: true,
                    panelHeight: 'auto',
                    hasDownArrow: true,
                    limitToList: true
                }, options || {}));
                console.log('init');
                return input;
            },
            setValue: function (target, value) {
                console.log('setValue');
                if (value) {
                    $(target).tagbox('setValues', value);

                } else {
                    $(target).tagbox('clear');
                }
            },
            getValue: function (target) {
                console.log('getValue');
                return $(target).tagbox('getValues');
            },
            resize: function (target, width) {
                console.log('resize');
                $(target).tagbox('resize', width);
            },
            destroy: function (target) {
                console.log('destroy');
                $(target).tagbox('destroy');
            }
        }
    });
$(target).tagbox('setValues', value); return bug
Code:
Uncaught TypeError: can't access property "textbox", $.data(...) is undefined
$(target).tagbox('clear'); return bug
Code:
Uncaught TypeError: can't access property "options", $.data(...) is undefined


Title: Re: BUG tagbox in datagridfilter
Post by: Vladzimir on November 28, 2025, 12:09:43 PM
This is a global error. It works even with textbox, but only when resetting the value.

Code:
$(target).textbox('setValue', '');

I fixed it using only
Code:
                try {
                    $(target).textbox('setValue', value);
                } catch (e) {
                }
or
Code:
                try {
                    $(target).tagbox('setValues', value);
                } catch (e) {
                }
Does anyone have any ideas as to why this is happening?