Select to view content in your preferred language

Can we modify the attribute inspector?

2897
19
09-22-2011 07:52 AM
LizDaRos
Regular Contributor
I'd like to change the setup of how the attribute inspector displays, such as position the delete button on the top of the page, not at the bottom under attachments.
I'm using the mobile attribute editing sample from ESRI.
Any help would greatly be appreciated. Thanks.
0 Kudos
19 Replies
LizDaRos
Regular Contributor
Using the mozilla firebug, this is what comes up for the "bubble"
<div class="ui-btn ui-btn-corner-all ui-shadow ui-btn-up-c" data-theme="c" aria-disabled="false">

I'm not very familar with what I need to change here to remove this bubble.
0 Kudos
KellyHutchins
Esri Frequent Contributor
Liz without seeing more of the code its hard to know where the 'bubble' is coming from. Is your application public? If so can you provide the url. If not can you post your code?
0 Kudos
LizDaRos
Regular Contributor
0 Kudos
KellyHutchins
Esri Frequent Contributor
Liz,

I think the easiest option would be to disable the attribute  inspector's delete button by setting showDeleteButton to true:
 var layerInfo = [{ 
          'featureLayer': results[0].layer, 
          'showAttachments':true, 
          'showDeleteButton':false, 
          'isEditable':true, 
          'fieldInfos':[ 
            {'fieldName':'requesttype','label':'Type','isEditable':true}, 
            {'fieldName':'address_num','label':'Issue Address #','isEditable':true},
            {'fieldName':'streetname','label':'Issue Street Name','tooltip': 'Start typing the street name for the list to populate','isEditable':true},
            {'fieldName':'email','label':'Contact Info','isEditable':true}, 
            {'fieldName':'comment','label':'Comments','isEditable':true,'stringFieldOption':esri.dijit.AttributeInspector.STRING_FIELD_OPTION_TEXTAREA} 
          ] 
        }]; 


Then add a jquery mobile button to the attribute inspector dialog and style this to suit your needs. When users click this new delete button you can use featureLayer.applyEdits to delete the current feature. Here's an example of code you could add to the delete button's onclick event
      function deleteFeature(){
      var graphics = citizenRequestLayer.getSelectedFeatures();
       if(graphics.length > 0){
        //remove any features
        citizenRequestLayer.applyEdits(null,null,graphics,function(){
          console.log('Features deleted');
           $.mobile.changePage("#mapPage",null,true,true);
        });
       }
        
      }


And here's an example of adding the jquery button.
 <div data-role="page" id="attributeDialog"   data-theme="c">
    <div data-role="header" data-backbtn="false"> 
      <h1>Report</h1> 
    </div> 
    <div data-role="content" data-inset="true"> 
    <!--<center><h6>(Please use the delete button to restart if the estimated location is incorrect)</h6></center>-->
      <div> 
          Estimated Location:
        <div id="currentAddress" title="Estimated Location" style="font-weight:bold;text-align:center;width:100%;"></div> 
      </div> 
      <br>
        <a href="#" data-role="button"  onclick="deleteFeature();" data-inline='true'>Delete</a> 
      <br>
      <div id="attributeDiv"></div>      
     <br>
      <a href="http://gis.manchesterct.gov/MObile/IssueRequests.html" onclick="alertsubmit();" data-role="button">Finish</a> 
    </div> 
  </div> 
0 Kudos
LizDaRos
Regular Contributor
Kelly,
Thank you so much. That helped a lot!
Liz
0 Kudos
LizDaRos
Regular Contributor
Kelly... or maybe someone else knows too,
I just noticed this issue; when I'm using my mobile phone and I browse to add an attachement I get redirected to another page after selecting the image. Sometimes this isn't the case but most of the time it is. When I'm testing this on a computer or Motorola Zoom I do not have this problem. It stays on the same page and just adds the image name to that section.
Anyone else come across this issue or is this something wrong in my code? Or something wrong with my feature?
0 Kudos
KellyHutchins
Esri Frequent Contributor
Many mobile browsers, including Safari for iPhone, do not support file upload so you won't be able to use the attachment editor. There are some third party apps that can help you add this functionality to your app. See the 'Volunteered Geographic Information' section of this blog post for details on one potential solution:

http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2010/09/01/Building-Web-applications-for-iOS-an...
0 Kudos
LizDaRos
Regular Contributor
I was just about to say something to you about the VGI; I was looking at that site a few months ago and just realized you were the one who contributed to it. Great work!
Mine and many of my users devices are androids. I had seen this issue with the iphone prior, I just didn't think there was a problem with the Android browsers as well. Especially since sometimes it does work on my phone.
0 Kudos
KellyHutchins
Esri Frequent Contributor
I ran a quick test using an older Motorola Droid (Android version 2.2.2) using the Attachment Editor sample from the help and was able to successfully browse to a photo and add it as an attachment.

http://help.arcgis.com/en/webapi/javascript/arcgis/demos/ed/ed_attachments.html

Perhaps this is an issue with certain phones?


Kelly
0 Kudos
LizDaRos
Regular Contributor
I've done some testing using the Attachment Editor sample from the help on other phones such as the droid 2 version 2.3.3, fascinate version 2.2.2, and a incredible version 2.2.2 and all are having the same issue with the android browser. It almost seems like the site doesn't wait for the phone to upload a picture before it times out. Then the page just refreshes and the point doesn't get created. I'm not sure what else I can do? I'm going to try and add the attachment editor that you used in 'Volunteered Geographic Information' and see if I can get that working.
0 Kudos