Esempio n. 1
0
        private void CreateWidgets(FormContext formContext, BaseField fieldInfo, FilterExpField filterField = null)
        {
            formContext.AddEntityModelInfo("FieldName", fieldInfo.Name);

            formContext.AddControl(AddFieldName(formContext, fieldInfo));

            var widgetContext = new WidgetContext(formContext);

            widgetContext.Build(fieldInfo, new TField()
            {
                FieldId = "Field"
            });
            widgetContext.IsRequired = false;
            widgetContext.Validation = null;

            var widget = WidgetFactory.Create(widgetContext);

            widget.OnCompile();
            if (filterField != null)
            {
                widget.SetValue(filterField.Value);
            }
            formContext.AddControl(widget);

            AddOperationField(formContext, fieldInfo, filterField);
        }
Esempio n. 2
0
        private void AddOperationField(FormContext formContext, BaseField fieldInfo, FilterExpField filterField = null)
        {
            var widgetContext = WidgetContext.BuildContext(formContext, "OP");

            widgetContext.WidgetType = FormControlType.Dropdown;

            DropdownWidget widget = (DropdownWidget)ViewModel.FormWidget.WidgetFactory.Create(widgetContext);

            widget.Options = GetOptions(fieldInfo.BaseType, fieldInfo.Type);
            widget.OnCompile();
            if (filterField != null)
            {
                widget.SetValue((int)filterField.Op);
            }

            formContext.AddControl(widget);
        }