public static jQueryObject Next(jQueryObject q, string selector) { for (q = q.Next(); q.Size() > 0 && !q.Is(selector); q = q.Next()) { ; } return(q); }
public void DeleteItem(int row) { numRows--; rowData.RemoveAt(row); #if CLIENT if (isAttached && !rebuilding) { int newSelection = SelectedRowIndex; bool changeSelection = false; if (SelectedRowIndex == row) { if (numRows > 0) { if (newSelection == numRows) { newSelection = numRows - 1; } } else { newSelection = -1; } changeSelection = true; } jQueryObject q = jQuery.FromElement(GetValuesTBody().Rows[row]).Remove(), next = q.Next(); q.Remove(); for (; next.Size() > 0; next = next.Next()) { if (next.Is("." + EvenRowClass)) { next.RemoveClass(EvenRowClass); next.AddClass(OddRowClass); } else { next.RemoveClass(OddRowClass); next.AddClass(EvenRowClass); } } if (changeSelection) { selectedRowIndex = -1; // hack to make the next procedure sure the GUI must be updated SelectedRowIndex = newSelection; OnSelectionChanged(EventArgs.Empty); } return; } #endif if (selectedRowIndex >= row) { selectedRowIndex--; } rowTextsIfNotRendered.RemoveAt(row); rowClassesIfNotRendered.RemoveAt(row); }
private void linkFn(IScope scope, jQueryObject element, object attrs) { forCounter++; var next = element.Next(); string id = next.GetAttribute("id"); if (id == null) { id = "forLink" + forCounter; next.Attribute("id", id); } element.Attribute("for", id); }
private void linkFn(IScope scope, jQueryObject element, object attrs) { forCounter++; var next = element.Next(); string id = next.GetAttribute("id"); if (id == null) { id = "forLink" + forCounter; next.Attribute("id", id); } element.Attribute("for", id); }
public DateTimeEditor(jQueryObject input, DateTimeEditorOptions opt) : base(input, opt) { input.AddClass("dateQ s-DateTimeEditor") .DatePicker(new DatePickerOptions { ShowOn = "button" }); input.Bind("keyup." + this.uniqueName, DateEditor.DateInputKeyup); input.Bind("change." + this.uniqueName, DateEditor.DateInputChange); time = J("<select/>") .AddClass("editor s-DateTimeEditor time") .InsertAfter(input.Next(".ui-datepicker-trigger")); foreach (var t in GetTimeOptions(fromHour: options.StartHour ?? 0, toHour: options.EndHour ?? 23, stepMins: options.IntervalMinutes ?? 30)) { Q.AddOption(time, t, t); } input.AddValidationRule(this.uniqueName, e => { var value = this.Value; if (string.IsNullOrEmpty(value)) { return(null); } if (!string.IsNullOrEmpty(MinValue) && String.Compare(value, MinValue) < 0) { return(String.Format(Q.Text("Validation.MinDate"), Q.FormatDate(Q.ParseISODateTime(MinValue)))); } if (!string.IsNullOrEmpty(MaxValue) && String.Compare(value, MaxValue) >= 0) { return(String.Format(Q.Text("Validation.MaxDate"), Q.FormatDate(Q.ParseISODateTime(MaxValue)))); } return(null); }); }
public DateTimeEditor(jQueryObject input) : base(input) { input.AddClass("dateQ s-DateTimeEditor") .DatePicker(new DatePickerOptions { ShowOn = "button" }); time = J("<select/>") .AddClass("editor s-DateTimeEditor time") .InsertAfter(input.Next(".ui-datepicker-trigger")); foreach (var t in GetTimeOptions()) { Q.AddOption(time, t, t); } }
public DateTimeEditor(jQueryObject input, DateTimeEditorOptions opt) : base(input, opt) { input.AddClass("dateQ s-DateTimeEditor") .DatePicker(new DatePickerOptions { ShowOn = "button", BeforeShow = new Func <bool>(delegate { return(!input.HasClass("readonly")); }), YearRange = options.YearRange ?? "-100:+50" }); input.Bind("keyup." + this.uniqueName, e => { if (e.Which == 32 && !ReadOnly) { if (this.ValueAsDate != JsDate.Now) { this.ValueAsDate = JsDate.Now; this.element.Trigger("change"); } } else { DateEditor.DateInputKeyup(e); } }); input.Bind("change." + this.uniqueName, DateEditor.DateInputChange); time = J("<select/>").AddClass("editor s-DateTimeEditor time"); var after = input.Next(".ui-datepicker-trigger"); if (after.Length > 0) { time.InsertAfter(after); } else { after = input.Prev(".ui-datepicker-trigger"); if (after.Length > 0) { time.InsertBefore(after); } else { time.InsertAfter(input); } } foreach (var t in GetTimeOptions(fromHour: options.StartHour ?? 0, toHour: options.EndHour ?? 23, stepMins: options.IntervalMinutes ?? 5)) { Q.AddOption(time, t, t); } input.AddValidationRule(this.uniqueName, e => { var value = this.Value; if (string.IsNullOrEmpty(value)) { return(null); } if (!string.IsNullOrEmpty(MinValue) && String.Compare(value, MinValue) < 0) { return(String.Format(Q.Text("Validation.MinDate"), Q.FormatDate(MinValue))); } if (!string.IsNullOrEmpty(MaxValue) && String.Compare(value, MaxValue) >= 0) { return(String.Format(Q.Text("Validation.MaxDate"), Q.FormatDate(MaxValue))); } return(null); }); SqlMinMax = true; J("<div class='inplace-button inplace-now'><b></b></div>") .Attribute("title", "set to now") .InsertAfter(time) .Click(e => { if (this.Element.HasClass("readonly")) { return; } this.ValueAsDate = JsDate.Now; }); time.On("change", e => input.TriggerHandler("change")); }