/// <summary>
        /// Converts this attribute to a form field.
        /// </summary>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="memberType">The type of the member.</param>
        /// <returns></returns>
        public override DextopFormField ToField(string memberName, Type memberType)
        {
            DextopFormField field = base.ToField(memberName, memberType);

            if (minLength > 0)
            {
                field["minLength"] = minLength;
            }
            if (maxLength > 0)
            {
                field["maxLength"] = maxLength;
            }
            if (regex != null)
            {
                field["regex"] = new DextopRawJs("/" + regex + "/");
            }
            if (regexText != null)
            {
                field["regexText"] = new DextopLocalizedText(field.ItemName + "RegextText", regexText);
            }
            if (maskRe != null)
            {
                field["maskRe"] = new DextopRawJs("/" + maskRe + "/");
            }
            return(field);
        }
        /// <summary>
        /// Converts this attribute to a form field.
        /// </summary>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="memberType">The type of the member.</param>
        /// <returns></returns>
        public override DextopFormField ToField(string memberName, Type memberType)
        {
            var res = base.ToField(memberName, memberType);

            if (lookupStoreId != null)
            {
                res["store"] = new DextopRawJs("Dextop.getStore('{0}', {{ autoLoad: true }})", lookupStoreId);
            }
            else if (api != null)
            {
                res["store"] = new DextopRawJs("Dextop.api('{0}').createStore()", api);
            }
            else
            {
                res["store"] = new DextopRawJs("options.remote.createStore('{0}')", lookupId ?? res.name);
            }
            res["valueField"] = "id";
            //res["displayField"] = "text"; //combo default
            res["queryMode"]        = "local";
            res["forceSelection"]   = forceSelection;
            res["disableKeyFilter"] = disableKeyFilter;
            res["editable"]         = editable;
            res["hideTrigger"]      = hideTrigger;
            return(res);
        }
Exemplo n.º 3
0
        DextopFormField ToField(string memberName, Type memberType, int index)
        {
            DextopFormField field = base.ToField(memberName, memberType);

            field.NameSuffix = "_" + index.ToString() + "_";
            if (inputValues != null && index < inputValues.Length)
            {
                field["inputValue"] = inputValues[index];
            }
            else
            {
                field["inputValue"] = index;
            }

            field.fieldLabel = field.boxLabel = null;
            field.Properties.Remove("fieldLabel");
            field.Properties.Remove("boxLabel");

            field["checked"] = new DextopRawJs("options.data['{0}'] === {1}", field.name, DextopUtil.Encode(field["inputValue"]));

            if (fieldLabels != null && index < fieldLabels.Length)
            {
                field.fieldLabel = fieldLabels[index];
            }

            if (boxLabels != null)
            {
                field.boxLabel = boxLabels[index];
            }

            return(field);
        }
        /// <summary>
        /// Converts this attribute to a form field.
        /// </summary>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="memberType">The type of the member.</param>
        /// <returns></returns>
        public override DextopFormField ToField(string memberName, Type memberType)
        {
            var res = base.ToField(memberName, memberType);

            res["store"]      = new DextopRawJs("options.remote.createStore('{0}')", lookupId ?? res.name);
            res["valueField"] = "id";
            //res["displayField"] = "text"; //combo default
            res["queryMode"]        = "local";
            res["forceSelection"]   = forceSelection;
            res["disableKeyFilter"] = disableKeyFilter;
            res["editable"]         = editable;
            return(res);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Converts this attribute to a form field.
        /// </summary>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="memberType">The type of the member.</param>
        /// <returns></returns>
        public override DextopFormField ToField(string memberName, Type memberType)
        {
            var res = base.ToField(memberName, memberType);

            res["valueField"]   = valueField;
            res["displayField"] = displayField;
            res["queryMode"]    = "remote";
            res["minChars"]     = minChars;
            if (valueNotFoundField != null)
            {
                res["valueNotFoundText"] = new DextopRawJs("options.data['{0}']{1}", valueNotFoundField, valueNotFoundText != null ? String.Format("|| '{0}'", valueNotFoundText) : null);
            }
            else if (valueNotFoundText != null)
            {
                res["valueNotFoundText"] = valueNotFoundText;
            }
            return(res);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Converts this attribute to a form field.
        /// </summary>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="memberType">The type of the member.</param>
        /// <returns></returns>
        public override DextopFormField ToField(string memberName, Type memberType)
        {
            var res = base.ToField(memberName, memberType);

            if (initialLookupValueField != null)
            {
                res["store"] = new DextopRawJs("options.remote.createStore('{0}', !Ext.isDefined(options.data['{1}']) ? {{}} : {{ data: [[options.data['{1}'], options.data['{2}']]] }})", lookupId ?? res.name, res.name, initialLookupValueField);
            }

            res["valueField"]   = valueField;
            res["displayField"] = displayField;
            res["queryMode"]    = "remote";
            res["minChars"]     = minChars;
            if (valueNotFoundField != null)
            {
                res["valueNotFoundText"] = new DextopRawJs("options.data['{0}']{1}", valueNotFoundField, valueNotFoundText != null ? String.Format("|| '{0}'", valueNotFoundText) : null);
            }
            else if (valueNotFoundText != null)
            {
                res["valueNotFoundText"] = valueNotFoundText;
            }
            return(res);
        }
        /// <summary>
        /// Converts this attribute to a form field.
        /// </summary>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="memberType">The type of the member.</param>
        /// <returns></returns>
        public override DextopFormField ToField(string memberName, Type memberType)
        {
            var res = base.ToField(memberName, memberType);

            if (initialLookupValueField != null)
            {
                if (api != null)
                {
                    res["store"] = new DextopRawJs("Dextop.api('{0}').createStore(!Ext.isDefined(options.data['{1}']) ? {{}} : {{ data: [[options.data['{1}'], options.data['{2}']]] }})", api, res.name, initialLookupValueField);
                }
                else
                {
                    res["store"] = new DextopRawJs("options.remote.createStore('{0}', !Ext.isDefined(options.data['{1}']) ? {{}} : {{ data: [[options.data['{1}'], options.data['{2}']]] }})", lookupId ?? res.name, res.name, initialLookupValueField);
                }
            }
            else if (autoLoadStore)
            {
                if (api != null)
                {
                    res["store"] = new DextopRawJs("Dextop.api('{0}').createStore({{ autoLoad: true }})", api);
                }
                else
                {
                    res["store"] = new DextopRawJs("options.remote.createStore('{0}', {{ autoLoad: true }})", lookupId ?? res.name);
                }
            }

            res["valueField"]   = valueField;
            res["displayField"] = displayField;
            res["queryMode"]    = "remote";
            res["minChars"]     = minChars;
            if (valueNotFoundText != null)
            {
                res["valueNotFoundText"] = valueNotFoundText;
            }
            return(res);
        }