Select to view content in your preferred language

DataGrid commit button not enabled

1454
11
02-15-2011 08:37 AM
DonFreeman
Emerging Contributor
What do I have to do to enable the commit button in my DataGrid? I can edit this data with a featureDataForm but when I try to do it with a datagrid the commit button does not become enabled. The datform isenabled = true and isreadonly = false.

Thanks for any suggestions.
0 Kudos
11 Replies
JenniferNery
Esri Regular Contributor
Are you using FeatureDataGrid? If yes, do you have GraphicsLayer property bound to a FeatureLayer from feature service? Is this FeatureLayer set to AutoSave=False?

Sorry, I have more questions than answers. Basically, FDG decides to enable Commit based on these settings. If FeatureLayer is read-only (using map service) or if AutoSave is true (by default it is true), then Commit will be disabled.
0 Kudos
DonFreeman
Emerging Contributor
Yes, it's a FeatureDataGrid.
Yes, the GraphicsLayer is bound to a FeatureLayer.
The featureLayer AutoSave is set to true. Setting it to false makes no difference.

I am using the same basic setup as I have for a FeatureDataForm (different page) which works OK.
0 Kudos
JenniferNery
Esri Regular Contributor
With AutoSave="True" on the FeatureLayer, FeatureDataGrid's Commit button is disabled because it does not require calling SaveEdits(). Any change to the layer are automatically pushed to the server. You need to set this to False if you want to explicitly perform the save with the Commit button.

FeatureDataForm Apply button only means you are done editing but it does not commit a save (unless AutoSave is true) unlike FeatureDataGrid's Commit button.  With AutoSave="False", you need to explicitly call SaveEdits() on FeatureDataForm's EditEnded. FeatureDataGrid on the other hand, will handle the save when you click "Commit".
0 Kudos
DonFreeman
Emerging Contributor
With AutoSave="True" on the FeatureLayer, FeatureDataGrid's Commit button is disabled because it does not require calling SaveEdits(). Any change to the layer are automatically pushed to the server. You need to set this to False if you want to explicitly perform the save with the Commit button.

FeatureDataForm Apply button only means you are done editing but it does not commit a save (unless AutoSave is true) unlike FeatureDataGrid's Commit button.  With AutoSave="False", you need to explicitly call SaveEdits() on FeatureDataForm's EditEnded. FeatureDataGrid on the other hand, will handle the save when you click "Commit".

Well, that's all well and good except the commit button is still not enabled when Autosave is set to false. See below.
<esri:FeatureLayer ID="AllAvailableLayer" 
      Url="http://gismaps.pagnet.org/ArcGIS/rest/services/testprojectALLBikeCounts/FeatureServer/0"
      SelectionColor="Yellow"
      Renderer="{StaticResource AllRenderer}"
      OutFields="*"
      DisableClientCaching="True"
      AutoSave="False"
      MouseLeftButtonUp="FeatureLayer_MouseLeftButtonUp" />

<!--and--> 

<esri:FeatureDataGrid x:Name="MyDataGrid" Grid.Column="0" Grid.Row="1" 
    Map="{Binding ElementName=MyMap}"
    GraphicsLayer="{Binding ElementName=MyMap, Path=Layers.[AllAvailableLayer]}"
    IsReadOnly="False"
    IsEnabled="True"
    AlternatingRowBackground="BurlyWood"
    AreRowDetailsFrozen="False"
        />


Errata - I just discovered that it does become enabled AFTER I move the pointer off the edited record. Is this normal behavior? Is there a way to enable it when the editing begins (like the dataform) or after moving from the edited column?
Thanks
0 Kudos
JenniferNery
Esri Regular Contributor
The expected behavior is that Commit button will be enabled once an edit to a field have been submitted (which you do when you leave the TextBox).

You can refer to the following example: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitFeatureDataGrid.

Commit button does not re-enable on TextChanged, it is only after you the TextBox looses focus that the change is detected.
0 Kudos
DonFreeman
Emerging Contributor
The expected behavior is that Commit button will be enabled once an edit to a field have been submitted (which you do when you leave the TextBox).

You can refer to the following example: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitFeatureDataGrid.

Commit button does not re-enable on TextChanged, it is only after you the TextBox looses focus that the change is detected.
Actually, the commit button in the sample does not become enabled until you leave the edited row. (At least when run on my box.) It would be better if it worked at the textbox level.
0 Kudos
JenniferNery
Esri Regular Contributor
Yup, you are right. I meant to make a correction on my previous post. Edit on the feature attribute is detected when the row looses focus.

I spoke with my colleague who worked on it and the reason for this design is subscribing to a TextChanged will be an expensive ("chatty") check.
0 Kudos
KareemMorsy1
New Contributor
hi

i have a problem in saving data on sde database i click commit but when i rerun the application the saves are not commited
0 Kudos
JenniferNery
Esri Regular Contributor
You can suscribe to FeatureLayer.EndSaveEdits and FeatureLayer.SaveEditsFailed events. Also try to run Fiddler to see the server detailed response on failure.
0 Kudos