internal static bool AreDefault(this JqGridColumnElementOptions elementOptions) { return(String.IsNullOrWhiteSpace(elementOptions.BuildSelect) && ((elementOptions.DataEvents == null) || (elementOptions.DataEvents.Count == 0)) && String.IsNullOrWhiteSpace(elementOptions.DataInit) && String.IsNullOrEmpty(elementOptions.DataUrl) && String.IsNullOrEmpty(elementOptions.DefaultValue) && ((elementOptions.HtmlAttributes == null) || (elementOptions.HtmlAttributes.Count == 0)) && String.IsNullOrEmpty(elementOptions.Value) && ((elementOptions.ValueDictionary == null) || (elementOptions.ValueDictionary.Count == 0))); }
internal static bool IsDefaultJQueryUISpinner(this JqGridColumnElementOptions elementOptions) { return((elementOptions.SpinnerDownIcon == JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.SpinnerDownIcon) && (elementOptions.SpinnerUpIcon == JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.SpinnerUpIcon) && (elementOptions.SpinnerIncremental == JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.SpinnerIncremental) && !elementOptions.SpinnerMax.HasValue && !elementOptions.SpinnerMin.HasValue && String.IsNullOrEmpty(elementOptions.SpinnerNumberFormat) && (elementOptions.SpinnerPage == JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.SpinnerPage) && (elementOptions.SpinnerStep == JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.SpinnerStep) && String.IsNullOrEmpty(elementOptions.SpinnerCulture)); }
private static StringBuilder AppendColumnModelElementOptions(this StringBuilder javaScriptBuilder, JqGridColumnElementOptions elementOptions, bool isJQueryUIElement) { if ((elementOptions.DataEvents != null) && (elementOptions.DataEvents.Count > 0)) { javaScriptBuilder.AppendJavaScriptArrayFieldOpening(JqGridOptionsNames.ColumnModel.Element.DATA_EVENTS); foreach (JqGridColumnDataEvent dataEvent in elementOptions.DataEvents) { javaScriptBuilder.AppendJavaScriptObjectOpening() .AppendJavaScriptObjectStringField(JqGridOptionsNames.ColumnModel.Element.DataEvent.TYPE, dataEvent.Type) .AppendJavaScriptObjectObjectField(JqGridOptionsNames.ColumnModel.Element.DataEvent.DATA, dataEvent.Data) .AppendJavaScriptObjectFunctionField(JqGridOptionsNames.ColumnModel.Element.DataEvent.FUNCTION, dataEvent.Function) .AppendJavaScriptObjectClosing(); } javaScriptBuilder.AppendJavaScriptArrayFieldClosing(); } if (!isJQueryUIElement) { javaScriptBuilder.AppendJavaScriptObjectFunctionField(JqGridOptionsNames.ColumnModel.Element.DATA_INIT, elementOptions.DataInit); if (!String.IsNullOrWhiteSpace(elementOptions.DataUrl)) { javaScriptBuilder.AppendJavaScriptObjectStringField(JqGridOptionsNames.ColumnModel.Element.DATA_URL, elementOptions.DataUrl) .AppendJavaScriptObjectFunctionField(JqGridOptionsNames.ColumnModel.Element.BUILD_SELECT, elementOptions.BuildSelect); } else if (!String.IsNullOrEmpty(elementOptions.Value)) { javaScriptBuilder.AppendJavaScriptObjectStringField(JqGridOptionsNames.ColumnModel.Element.VALUE, elementOptions.Value); } else if (elementOptions.ValueDictionary != null) { javaScriptBuilder.AppendJavaScriptObjectObjectField(JqGridOptionsNames.ColumnModel.Element.VALUE, elementOptions.ValueDictionary); } } return(javaScriptBuilder.AppendJavaScriptObjectStringField(JqGridOptionsNames.ColumnModel.Element.DEFAULT_VALUE, elementOptions.DefaultValue)); }
private static StringBuilder AppendColumnModelJQueryUISpinnerDataInit(this StringBuilder javaScriptBuilder, JqGridColumnElementOptions elementOptions) { StringBuilder jQueryUISpinnerDataInitBuilder = new StringBuilder(JQUERY_UI_SPINNER_DATA_INIT_START.Length + JQUERY_UI_SPINNER_DATA_INIT_END.Length); jQueryUISpinnerDataInitBuilder.Append(JQUERY_UI_SPINNER_DATA_INIT_START); if (!elementOptions.IsDefaultJQueryUISpinner()) { jQueryUISpinnerDataInitBuilder.AppendJavaScriptObjectOpening(); if ((elementOptions.SpinnerDownIcon != JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.SpinnerDownIcon) || (elementOptions.SpinnerUpIcon != JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.SpinnerUpIcon)) { jQueryUISpinnerDataInitBuilder.AppendJavaScriptObjectFieldOpening(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.SPINNER_ICONS) .AppendJavaScriptObjectStringField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.SPINNER_DOWN_ICON, elementOptions.SpinnerDownIcon, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.SpinnerDownIcon) .AppendJavaScriptObjectStringField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.SPINNER_UP_ICON, elementOptions.SpinnerUpIcon, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.SpinnerUpIcon) .AppendJavaScriptObjectFieldClosing(); } jQueryUISpinnerDataInitBuilder.AppendJavaScriptObjectStringField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.SPINNER_CULTURE, elementOptions.SpinnerCulture) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.SPINNER_INCREMENTAL, elementOptions.SpinnerIncremental, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.SpinnerIncremental) .AppendJavaScriptObjectIntegerField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.SPINNER_MAX, elementOptions.SpinnerMax) .AppendJavaScriptObjectIntegerField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.SPINNER_MIN, elementOptions.SpinnerMin) .AppendJavaScriptObjectStringField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.SPINNER_NUMBER_FORMAT, elementOptions.SpinnerNumberFormat) .AppendJavaScriptObjectIntegerField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.SPINNER_PAGE, elementOptions.SpinnerPage, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.SpinnerPage) .AppendJavaScriptObjectIntegerField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.SPINNER_STEP, elementOptions.SpinnerStep, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.SpinnerStep) .AppendJavaScriptObjectClosing(); } jQueryUISpinnerDataInitBuilder.Append(JQUERY_UI_SPINNER_DATA_INIT_END); return(javaScriptBuilder.AppendJavaScriptObjectFunctionField(JqGridOptionsNames.ColumnModel.Element.DATA_INIT, jQueryUISpinnerDataInitBuilder.ToString())); }
private static StringBuilder AppendColumnModelJQueryUIDatepickerDataInit(this StringBuilder javaScriptBuilder, JqGridColumnElementOptions elementOptions, JqGridOptions options, bool asSubgrid) { StringBuilder jQueryUIDatepickerDataInitBuilder = new StringBuilder(JQUERY_UI_DATEPICKER_DATA_INIT_START.Length + JQUERY_UI_DATEPICKER_DATA_INIT_END.Length); string jQueryGridElement = asSubgrid ? JqGridSubgridJavaScriptRenderingHelper.SUBGRID_VARIABLE : String.Format("$('#{0}')", options.Id); jQueryUIDatepickerDataInitBuilder.Append(JQUERY_UI_DATEPICKER_DATA_INIT_START) .AppendJavaScriptObjectOpening() .AppendJavaScriptObjectFunctionField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_DAY_NAMES, String.Format(_jqueryUiDatepickerDaysNamesFunctions[options.CompatibilityMode], jQueryGridElement)) .AppendJavaScriptObjectFunctionField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_DAY_NAMES_MIN, String.Format(_jqueryUiDatepickerDaysNamesShortFunctions[options.CompatibilityMode], jQueryGridElement)) .AppendJavaScriptObjectFunctionField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_DAY_NAMES_SHORT, String.Format(_jqueryUiDatepickerDaysNamesShortFunctions[options.CompatibilityMode], jQueryGridElement)) .AppendJavaScriptObjectFunctionField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_MONTH_NAMES, String.Format(_jqueryUiDatepickerMonthsNamesFunctions[options.CompatibilityMode], jQueryGridElement)) .AppendJavaScriptObjectFunctionField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_MONTH_NAMES_SHORT, String.Format(_jqueryUiDatepickerMonthsNamesShortFunctions[options.CompatibilityMode], jQueryGridElement)) .AppendJavaScriptObjectStringField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_APPEND_TEXT, elementOptions.DatepickerAppendText) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_AUTO_SIZE, elementOptions.DatepickerAutoSize, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.DatepickerAutoSize) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_CHANGE_MONTH, elementOptions.DatepickerChangeMonth, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.DatepickerChangeMonth) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_CHANGE_YEAR, elementOptions.DatepickerChangeYear, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.DatepickerChangeYear) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_CONSTRAIN_INPUT, elementOptions.DatepickerConstrainInput, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.DatepickerConstrainInput) .AppendJavaScriptObjectStringField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_DATE_FORMAT, elementOptions.DatePickerDateFormat, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.DatepickerDateFormat) .AppendJavaScriptObjectIntegerField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_FIRST_DAY, elementOptions.DatepickerFirstDay, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.DatepickerFirstDay) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_GO_TO_CURRENT, elementOptions.DatepickerGotoCurrent, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.DatepickerGotoCurrent) .AppendJavaScriptObjectStringField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_MAX_DATE, elementOptions.DatepickerMaxDate) .AppendJavaScriptObjectStringField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_MIN_DATE, elementOptions.DatepickerMinDate) .AppendJavaScriptObjectIntegerField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_NUMBER_OF_MONTHS, elementOptions.DatepickerNumberOfMonths, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.DatepickerNumberOfMonths) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_SELECT_OTHER_MONTHS, elementOptions.DatepickerSelectOtherMonths, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.DatepickerSelectOtherMonths) .AppendJavaScriptObjectStringField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_SHORT_YEAR_CUTOFF, elementOptions.DatepickerShortYearCutoff, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.DatepickerShortYearCutoff) .AppendJavaScriptObjectIntegerField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_SHOW_CURRENT_AT_POS, elementOptions.DatepickerShowCurrentAtPos, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.DatepickerShowCurrentAtPos) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_SHOW_MONTH_AFTER_YEAR, elementOptions.DatepickerShowMonthAfterYear, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.DatepickerShowMonthAfterYear) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_SHOW_OTHER_MONTHS, elementOptions.DatepickerShowOtherMonths, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.DatepickerShowOtherMonths) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_SHOW_WEEK, elementOptions.DatepickerShowWeek, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.DatepickerShowWeek) .AppendJavaScriptObjectIntegerField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_STEP_MONTHS, elementOptions.DatepickerStepMonths, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.DatepickerStepMonths) .AppendJavaScriptObjectStringField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_YEAR_RANGE, elementOptions.DatepickerYearRange, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.DatepickerYearRange) .AppendJavaScriptObjectStringField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.DATEPICKER_YEAR_SUFFIX, elementOptions.DatepickerYearSuffix) .AppendJavaScriptObjectClosing() .Append(JQUERY_UI_DATEPICKER_DATA_INIT_END); return(javaScriptBuilder.AppendJavaScriptObjectFunctionField(JqGridOptionsNames.ColumnModel.Element.DATA_INIT, jQueryUIDatepickerDataInitBuilder.ToString())); }
private static StringBuilder AppendColumnModelJQueryUIAutocompleteDataInit(this StringBuilder javaScriptBuilder, JqGridColumnElementOptions elementOptions) { StringBuilder jQueryUIAutocompleteDataInitBuilder = new StringBuilder(JQUERY_UI_AUTOCOMPLETE_DATA_INIT_START.Length + JQUERY_UI_AUTOCOMPLETE_DATA_INIT_END.Length + JqGridOptionsNames.ColumnModel.JQueryUIWidgets.AUTOCOMPLETE_SOURCE.Length + elementOptions.DataUrl.Length + 5); jQueryUIAutocompleteDataInitBuilder.Append(JQUERY_UI_AUTOCOMPLETE_DATA_INIT_START) .AppendJavaScriptObjectOpening() .AppendJavaScriptObjectStringField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.AUTOCOMPLETE_SOURCE, elementOptions.DataUrl) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.AUTOCOMPLETE_AUTO_FOCUS, elementOptions.AutocompleteAutoFocus, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.AutocompleteAutoFocus) .AppendJavaScriptObjectIntegerField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.AUTOCOMPLETE_DELAY, elementOptions.AutocompleteDelay, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.AutocompleteDelay) .AppendJavaScriptObjectIntegerField(JqGridOptionsNames.ColumnModel.JQueryUIWidgets.AUTOCOMPLETE_MIN_LENGTH, elementOptions.AutocompleteMinLength, JqGridOptionsDefaults.ColumnModel.JQueryUIWidgets.AutocompleteMinLength) //.AppendJavaScriptObjectStringField("appendTo", $"#searchmodfbox_{options.Id}") .AppendJavaScriptObjectClosing() .Append(JQUERY_UI_AUTOCOMPLETE_DATA_INIT_END); return(javaScriptBuilder.AppendJavaScriptObjectFunctionField(JqGridOptionsNames.ColumnModel.Element.DATA_INIT, jQueryUIAutocompleteDataInitBuilder.ToString())); }