geoext/geoext1

Support gml enumeration constraint and display combobox

Opened this issue · 1 comments

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"])) {