Пример #1
0
        protected override void InplaceCreateClick(jQueryEvent e)
        {
            if (ReadOnly)
            {
                return;
            }

            var self = this;

            CreateEditDialog(dialog =>
            {
                (dialog.As <Widget>()).BindToDataChange(this, (x, dci) =>
                {
                    Q.ReloadLookup(GetLookupKey());
                    self.UpdateItems();
                    this.lastCreateTerm = null;

                    if ((dci.Type == "create" || dci.Type == "update") && dci.EntityId != null)
                    {
                        var id = dci.EntityId.ToString();
                        if (this.multiple)
                        {
                            var values = self.Values.Clone().As <List <string> >();
                            if (!values.Contains(id))
                            {
                                values.Add(id);
                            }
                            self.Values = null;
                            self.Values = values.ToArray();
                        }
                        else
                        {
                            self.Value = null;
                            self.Value = id;
                        }
                    }
                    else if (multiple && dci.Type == "delete" && dci.EntityId != null)
                    {
                        var id     = dci.EntityId.ToString();
                        var values = self.Values.Clone().As <List <string> >();
                        values.Remove(id);
                        self.Values = values.ToArray();
                    }
                    else if (!multiple)
                    {
                        self.Value = null;
                    }
                });

                var editItem = e.As <JsDictionary <string, object> >()["editItem"];

                if (editItem != null)
                {
                    dialog.Load(editItem, () => dialog.DialogOpen(OpenDialogAsPanel), null);
                }
                else if (this.multiple || this.Value.IsEmptyOrNull())
                {
                    var entity = new object().As <TItem>();
                    entity.As <JsDictionary <string, object> >()[GetLookup().TextField] = lastCreateTerm.TrimToEmpty();

                    InitNewEntity(entity);

                    dialog.Load(entity, () => dialog.DialogOpen(OpenDialogAsPanel), null);
                }
                else
                {
                    dialog.Load(this.Value, () => dialog.DialogOpen(OpenDialogAsPanel), null);
                }
            });
        }
Пример #2
0
 public void Expand(jQueryEvent @event) {
 }
Пример #3
0
 private void SearchButtonClick(jQueryEvent e)
 {
     e.PreventDefault();
     Search();
 }
Пример #4
0
 public void Select(jQueryEvent @event) {
 }
Пример #5
0
 public void Collapse(jQueryEvent @event) {
 }
Пример #6
0
 /// <summary>
 /// Detaches a handler for the specified event on the matched set of elements.
 /// </summary>
 /// <param name="e">The event passed in into an event handler.</param>
 /// <returns>The current jElement.</returns>
 public jElement unbind(jQueryEvent e) {
     return null;
 }
Пример #7
0
 public void NextPage(jQueryEvent @event) {
 }
Пример #8
0
        public static void DateInputKeyup(jQueryEvent e)
        {
            if (Q.Culture.DateOrder != "dmy")
            {
                return;
            }

            var input = J(e.Target);

            if (!input.Is(":input"))
            {
                return;
            }

            if (input.Is("[readonly]") || input.Is(":disabled"))
            {
                return;
            }

            var val = (input.GetValue() ?? "");

            if (val.Length == 0 || ((dynamic)input[0]).selectionEnd != val.Length)
            {
                return;
            }

            if (val.Contains(Q.Culture.DateSeparator + Q.Culture.DateSeparator))
            {
                input.Value(val.Replace(Q.Culture.DateSeparator + Q.Culture.DateSeparator, Q.Culture.DateSeparator));
                return;
            }

            if (e.Which == 47 || e.Which == 111) // slash key
            {
                if (val.Length >= 2 &&
                    val[val.Length - 1].ToString() == Q.Culture.DateSeparator &&
                    val[val.Length - 2].ToString() == Q.Culture.DateSeparator)
                {
                    input.Value(val.Substr(0, val.Length - 1));
                    return;
                }

                if (val[val.Length - 1].ToString() != Q.Culture.DateSeparator)
                {
                    return;
                }

                switch (val.Length)
                {
                case 2:
                    if (IsNumeric(val[0]))
                    {
                        val = "0" + val;
                        break;
                    }
                    else
                    {
                        return;
                    }

                case 4:
                    if (IsNumeric(val[0]) && IsNumeric(val[2]) && val[1].ToString() == Q.Culture.DateSeparator)
                    {
                        val = "0" + val[0].ToString() + Q.Culture.DateSeparator + "0" + val[2].ToString() + Q.Culture.DateSeparator;
                        break;
                    }
                    else
                    {
                        return;
                    }

                case 5:
                    if (IsNumeric(val[0]) && IsNumeric(val[2]) && IsNumeric(val[3]) &&
                        val[1].ToString() == Q.Culture.DateSeparator)
                    {
                        val = "0" + val;
                        break;
                    }
                    else if (IsNumeric(val[0]) && IsNumeric(val[1]) && IsNumeric(val[3]) &&
                             val[2].ToString() == Q.Culture.DateSeparator)
                    {
                        val = val[0].ToString() + val[1].ToString() + Q.Culture.DateSeparator + "0" + val[3].ToString() + Q.Culture.DateSeparator;
                        break;
                    }
                    else
                    {
                        break;
                    }

                default:
                    return;
                }

                input.Value(val);
            }

            if (val.Length < 6 && ((e.Which >= 48 && e.Which <= 57) || (e.Which >= 96 && e.Which <= 105)) &&
                IsNumeric(val[val.Length - 1]))
            {
                switch (val.Length)
                {
                case 1:
                    if (val[0] <= '3')
                    {
                        return;
                    }
                    val = "0" + val;
                    break;

                case 2:
                    if (!IsNumeric(val[0]))
                    {
                        return;
                    }
                    break;

                case 3:
                    if (!IsNumeric(val[0]) ||
                        val[1].ToString() != Q.Culture.DateSeparator ||
                        val[2] <= '1')
                    {
                        return;
                    }

                    val = "0" + val[0].ToString() + Q.Culture.DateSeparator + "0" + val[2].ToString();
                    break;

                case 4:
                    if (val[1].ToString() == Q.Culture.DateSeparator)
                    {
                        if (!IsNumeric(val[0]) || !IsNumeric(val[2]))
                        {
                            return;
                        }

                        val = "0" + val;
                        break;
                    }
                    else if (val[2].ToString() == Q.Culture.DateSeparator)
                    {
                        if (!IsNumeric(val[0]) || !IsNumeric(val[1]) || val[3] <= '1')
                        {
                            return;
                        }
                        val = val[0].ToString() + val[1].ToString() + Q.Culture.DateSeparator + "0" + val[3].ToString();
                        break;
                    }
                    else
                    {
                        return;
                    }

                case 5:
                    if (val[2].ToString() != Q.Culture.DateSeparator ||
                        !IsNumeric(val[0]) || !IsNumeric(val[1]) || !IsNumeric(val[3]))
                    {
                        return;
                    }
                    break;

                default:
                    return;
                }

                input.Value(val + Q.Culture.DateSeparator);
            }
        }
Пример #9
0
 public bool Trigger(string type, jQueryEvent @event, object data)
 {
     return(false);
 }
Пример #10
0
 public static bool HasOriginalEvent(this jQueryEvent e)
 {
     return(!Script.IsUndefined(((dynamic)e).originalEvent));
 }
 private void OnClearCompletedClick(jQueryEvent e)
 {
     _todoList.DeleteItems();
     UpdateRendering();
 }
Пример #12
0
        private void ValuesDiv_Drop(jQueryEvent evt, DropEvent ui)
        {
            if (currentDropTarget == null)
            {
                DragEnded();
                return;
            }

            int draggingIndex = selectedRowIndex;

            Element valuesDiv     = GetElement().Children[1];
            Element draggedElem   = ui.Draggable.GetElement(0);
            Element valuesTbodyEl = GetValuesTBody();

            if (currentDropTarget == valuesDiv)
            {
                // Dropping as the last element
                if (selectedRowIndex == NumRows - 1)
                {
                    DragEnded();
                    return;
                }

                GridDragDropCompletingEventArgs e = new GridDragDropCompletingEventArgs(draggingIndex, NumRows - 1);
                OnDragDropCompleting(e);
                if (e.Cancel)
                {
                    DragEnded();
                    return;
                }

                valuesTbodyEl.RemoveChild(draggedElem);
                valuesTbodyEl.AppendChild(draggedElem);
                object data = rowData[draggingIndex];
                rowData.RemoveAt(draggingIndex);
                rowData.Add(data);
                selectedRowIndex = NumRows - 1;
                GetElement().Focus();

                OnDragDropCompleted(new GridDragDropCompletedEventArgs(draggingIndex, NumRows - 1));
            }
            else
            {
                // Dropping on a row
                int newIndex = ((TableRowElement)currentDropTarget).RowIndex;
                newIndex = (newIndex > selectedRowIndex ? newIndex - 1 : newIndex);                 // If dragging down we have to pretend that the original row does not exist.
                if (newIndex == selectedRowIndex)
                {
                    return;
                }

                GridDragDropCompletingEventArgs e = new GridDragDropCompletingEventArgs(draggingIndex, newIndex);
                OnDragDropCompleting(e);
                if (e.Cancel)
                {
                    DragEnded();
                    return;
                }

                valuesTbodyEl.RemoveChild(draggedElem);
                valuesTbodyEl.InsertBefore(draggedElem, currentDropTarget);
                object data = rowData[draggingIndex];
                rowData.RemoveAt(draggingIndex);
                rowData.Insert(newIndex, data);
                selectedRowIndex = newIndex;
                GetElement().Focus();

                OnDragDropCompleted(new GridDragDropCompletedEventArgs(draggingIndex, newIndex));
            }

            DragEnded();
        }
Пример #13
0
 private void LeftRightParenClick(jQueryEvent e)
 {
     e.PreventDefault();
     J(e.Target).ToggleClass("active");
     UpdateParens();
 }
Пример #14
0
 private void AddButtonClick(jQueryEvent e)
 {
     AddEmptyRow(true);
     e.PreventDefault();
 }
Пример #15
0
 /// <summary>
 /// Programmatically close a tooltip. Sames rules as for <code>open</code> method.
 /// </summary>
 public void Close(jQueryEvent @event)
 {
 }
Пример #16
0
        private void Edit(jQueryEvent eventHandler)
        {
            this.GetCurrentEmployeeById(eventHandler.CurrentTarget.GetAttribute("employeeId").ToString());

            this.employeeService.DisplayForm(this.SelectedEmployee);
        }
Пример #17
0
 /// <summary>
 /// Programmatically open a tooltip. If the widget's element is the target, the event argument is optional. Otherwise you have to pass an event object with the <code>currentTarget</code> property pointing at the target.
 /// </summary>
 public void Open(jQueryEvent @event)
 {
 }
Пример #18
0
 public bool Trigger(string type, jQueryEvent @event, object data) {
         return false;
 }
Пример #19
0
 public void Next(jQueryEvent @event) {
 }
Пример #20
0
 protected virtual void QuickFilterChange(jQueryEvent e)
 {
     this.Refresh();
 }
Пример #21
0
 public void PreviousPage(jQueryEvent @event) {
 }
Пример #22
0
 private void ViewRowCountChanged(jQueryEvent e, dynamic d)
 {
     this.slickGrid.UpdateRowCount();
     this.slickGrid.Render();
 }
Пример #23
0
 public void Blur(jQueryEvent @event) {
 }
Пример #24
0
 private void Collapse(jQueryEvent e)
 {
     Window.Alert("On Collapse");
 }
Пример #25
0
 public void CollapseAll(jQueryEvent @event, bool all) {
 }
Пример #26
0
 /// <summary>
 /// Returns a hash containing row and cell indexes from a standard W3C/jQuery event.
 /// </summary>
 /// <param name="e">A standard W3C/jQuery event.</param>
 public SlickRowCell GetCellFromEvent(jQueryEvent e)
 {
     return(null);
 }
Пример #27
0
 public void Focus(jQueryEvent @event, jQueryObject item) {
 }
Пример #28
0
 protected virtual void InplaceCreateClick(jQueryEvent e)
 {
 }