AttributeInspector: stringFieldOption has no effect

1501
3
03-22-2011 04:55 PM
S_Ector
New Contributor
I am using the attribute inspector in a tabbed container in a dijit.Dialog.  It works fine, but now I would like to make some of the fields have a text area instead of a textbox.  The only change I am making is to add 'stringFieldOption':esri.dijit.AttributeInspector.STRING_FIELD_OPTION_TEXTAREA to the fieldInfos field definition.  However, there is no change in the attributeInspector for the field to a text area.

var costFieldInfos = [
{'fieldName': 'cost_est_interval_num', 'isEditable':true,  'label':'Cost Interval:'},
{'fieldName':'cost_est_interval_comments','isEditable':true, 'label':'Comments', 'stringFieldOption':esri.dijit.AttributeInspector.STRING_FIELD_OPTION_TEXTAREA}
];

var layerInfos = [{
        'featureLayer': actionTableFL,
        'showAttachments': false,
        'isEditable': true,
        'showDeleteButton': false,
        'fieldInfos': costFieldInfos
    }];

var attInspector = new esri.dijit.AttributeInspector({
        layerInfos: layerInfos
    }, dojo.create("div"));

Are there additional changes I need to do?  Also, is there a way to customize the width of the text input boxes?

Thanks.
0 Kudos
3 Replies
derekswingley1
Frequent Contributor
I don't have much experience with the attribute inspector but I was able to modify Attribute Inspector sample and get the desired behavior. Both of these produced a text area for me:
{'fieldName': 'station_id','tooltip': 'The station id.', 'label':'Station:','isEditable':false, 'stringFieldOption': 'textarea'}
           
{'fieldName': 'station_id','tooltip': 'The station id.', 'label':'Station:','isEditable':true, 'stringFieldOption': esri.dijit.AttributeInspector.STRING_FIELD_OPTION_TEXTAREA}


As for changing the width of dijit text boxes/text areas...I wish I had a better way but you should be able to do this via CSS. The tricky part is getting the right dom node. The dojo campus dijit text box page has an example that might help. Something like:
var box = dijit.byId("progBox");
dojo.style(box.domNode, "width", "5em"); 


The problem is getting the dijit's ID since everything in the attribute inspector is built programmatically...
0 Kudos
S_Ector
New Contributor
Thanks for the 'textarea' tip.  That did the trick, so I must not be including something.  At least now I know where to look.  I'll see if I can figure out about the lengths. 

Maybe someone out there has had success changing the lengths and could provide info here...?
0 Kudos
S_Ector
New Contributor
This did the trick and widened all the fields including the text areas:

      .esriAttributeInspector .dijitTextBox { width:20em;}
0 Kudos