public ViewFieldGroup CreateViewFieldGroup(TableField tf)
        {
            var vfg = new ViewFieldGroup();
            var vf  = tf as ViewField;

            if (string.IsNullOrEmpty(vf.Group))
            {
                if (".text.number.date.time.url.email.file.search".IndexOf(tf.ViewDataType) > 0)
                {
                    vf.HTMLControl = "input";
                    vf.HTML5Type   = tf.ViewDataType;
                    vf.PlaceHolder = vf.Name;
                    vf.Caption     = "";
                    vfg.Fields.Add(vf);
                }
                else if (!string.IsNullOrEmpty(vf.RelatedTable))
                {
                    //combo
                    vf.HTMLControl = "select";
                    vf.Group       = vf.RelatedTable;

                    if (Tables[vf.RelatedTable].Dynamic)
                    {
                        ViewField vfText = new ViewField($"{vf.Name}_input");
                        vfText.PlaceHolder = vf.Name;
                        vfText.Group       = vf.RelatedTable;
                        ViewField vfButton = new ViewField($"{vf.Name}_button");
                        vfButton.HTMLControl = "button";
                        vfButton.Caption     = "+";
                        vfButton.Group       = vf.RelatedTable;

                        vf.Caption     = "";
                        vfText.Caption = vf.Name;
                        vfg.Fields.Add(vf);
                        vfg.Fields.Add(vfText);
                        vfg.Fields.Add(vfButton);
                    }
                    else
                    {
                        vfg.Fields.Add(vf);
                    }
                }
            }
            else
            {
                vfg.Name = vf.Group;
                //todo project group fields and build FieldGroup
            }
            return(vfg);
        }
Exemple #2
0
        public override void CreateApplication()
        {
            Name = "Links";
            var view = new View();

            view.FieldGroups.Add(new ViewFieldGroup(new ViewField()
            {
                Name = "Fecha", HTML5Type = "hidden"
            }));
            view.FieldGroups.Add(new ViewFieldGroup(new ViewField()
            {
                Name = "Hora", HTML5Type = "hidden"
            }));

            var fildNewCat = new ViewField()
            {
                Name = "newCategory", Caption = "New Category", OnLooseFocus = "update('catList(this)'"
            };
            var fieldCatList = new ViewField()
            {
                Name = "catList", Caption = "Categories"
            };
            var gf = new ViewFieldGroup();

            gf.Fields.Add(fildNewCat);
            gf.Fields.Add(fieldCatList);
            view.FieldGroups.Add(gf);

            view.FieldGroups.Add(new ViewFieldGroup("ShortDescr"));
            view.FieldGroups.Add(new ViewFieldGroup("Title"));
            view.FieldGroups.Add(new ViewFieldGroup(new ViewField()
            {
                Name = "Url", HTML5Type = "url"
            }));
            view.FieldGroups.Add(new ViewFieldGroup(new ViewField()
            {
                Name = "Image", HTML5Type = "file"
            }));

            Views.Add(view);
        }