Ejemplo n.º 1
0
        public Select2AjaxEditor(jQueryObject hidden, TOptions opt)
            : base(hidden, opt)
        {
            var emptyItemText = EmptyItemText();

            if (emptyItemText != null)
            {
                hidden.Attribute("placeholder", emptyItemText);
            }

            hidden.Select2(GetSelect2Options());

            hidden.Attribute("type", "text"); // jquery validate to work

            hidden.Bind2("change." + this.uniqueName, (e, x) =>
            {
                if (e.HasOriginalEvent() || Q.IsFalse(x))
                {
                    if (hidden.GetValidator() != null)
                    {
                        hidden.Valid();
                    }
                }
            });
        }
Ejemplo n.º 2
0
        public Select2Editor(jQueryObject hidden, TOptions opt)
            : base(hidden, opt)
        {
            items    = new List <Select2Item>();
            itemById = new JsDictionary <string, Select2Item>();

            var emptyItemText = EmptyItemText();

            if (emptyItemText != null)
            {
                hidden.Attribute("placeholder", emptyItemText);
            }

            var select2Options = GetSelect2Options();

            multiple = Q.IsTrue(select2Options.Multiple);
            hidden.Select2(select2Options);

            hidden.Attribute("type", "text"); // jquery validate to work
            hidden.Bind2("change." + this.uniqueName, (e, x) =>
            {
                if (e.HasOriginalEvent() || Q.IsFalse(x))
                {
                    if (hidden.GetValidator() != null)
                    {
                        hidden.Valid();
                    }
                }
            });
        }
Ejemplo n.º 3
0
        private void OnRowFieldChange(jQueryEvent e)
        {
            jQueryObject row = J(e.Target).Closest("div.filter-line");

            RowFieldChange(row);
            jQueryObject opSelect = row.Children("div.o").Find("input.op-select");

            opSelect.Select2("focus");
        }