Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support gml enumeration constraint and display combobox #45

Open
fredmorin opened this issue May 9, 2012 · 1 comment
Open

Support gml enumeration constraint and display combobox #45

fredmorin opened this issue May 9, 2012 · 1 comment

Comments

@fredmorin
Copy link

In GeoExt/widgets/form.js, at line 134. I changed the following to support enumeration constraints for string.

if(type.match(r["text"])) {
    if(restriction.enumeration)
    {
        // Must convert the array into an array of array.
        var enumeration = new Array();
        for ( var i = 0, c = restriction.enumeration.length; i < c; i++ ) {
            enumeration[i] = [restriction.enumeration[i]];
        }

        var enumerationStore = new Ext.data.ArrayStore({
            data   : enumeration,
            fields : [label]
        });

        field = {
            xtype: "combo",
            name: name,
            fieldLabel: 'Letter',
            store: enumerationStore,
            mode: 'local',
            valueField:label,
            displayField:label,
            typeAhead: false,
            forceSelection: true
        };          
    }
    else{
        var maxLength = restriction["maxLength"] !== undefined ?
            parseFloat(restriction["maxLength"]) : undefined;
        var minLength = restriction["minLength"] !== undefined ?
            parseFloat(restriction["minLength"]) : undefined;
        field = {
            xtype: "textfield",
            name: name,
            fieldLabel: label,
            maxLength: maxLength,
            minLength: minLength
        };
    }
} else if(type.match(r["number"])) {
@bartvde
Copy link
Member

bartvde commented Sep 11, 2012

Can you share your GML DescribeFeatureType output?

Since AFAICT enumerations are already supported, see:

https://github.com/geoext/geoext/blob/master/lib/GeoExt/widgets/form.js#L188
https://github.com/geoext/geoext/blob/master/tests/lib/GeoExt/widgets/form.js#L49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants