コード例 #1
0
        public static void ToggleClick <TEntity>(jQueryEvent e, int row, int cell, SlickRemoteView <TEntity> view, Func <TEntity, object> getId)
        {
            var target = jQuery.FromElement(e.Target);

            if (!target.HasClass("s-TreeToggle"))
            {
                return;
            }

            if (target.HasClass("s-TreeCollapse") ||
                target.HasClass("s-TreeExpand"))
            {
                dynamic item = view.Rows[row];
                if (item != null)
                {
                    if (Q.IsFalse(item._collapsed))
                    {
                        item._collapsed = true;
                    }
                    else
                    {
                        item._collapsed = false;
                    }
                    view.UpdateItem(getId(item), item);
                }
            }
        }
コード例 #2
0
        public static void ToggleClick <TEntity>(jQueryEvent e, int row, int cell, SlickRemoteView <TEntity> view, Func <TEntity, object> getId)
        {
            var target = jQuery.FromElement(e.Target);

            if (!target.HasClass("s-TreeToggle"))
            {
                return;
            }

            if (target.HasClass("s-TreeCollapse") ||
                target.HasClass("s-TreeExpand"))
            {
                dynamic item = view.GetItem(row);
                if (item != null)
                {
                    if (Q.IsFalse(item._collapsed))
                    {
                        item._collapsed = true;
                    }
                    else
                    {
                        item._collapsed = false;
                    }
                    view.UpdateItem(getId(((object)item).As <TEntity>()), ((object)item).As <TEntity>());
                }

                if (e.ShiftKey)
                {
                    view.BeginUpdate();
                    try
                    {
                        SetCollapsed(view.GetItems(), item._collapsed);
                        view.SetItems(view.GetItems(), true);
                    }
                    finally
                    {
                        view.EndUpdate();
                    }
                }
            }
        }