geoext1
geoext1 copied to clipboard
Support gml enumeration constraint and display combobox
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"])) {
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