Display new records inserted in the table in the Attribute Pane

438
3
05-14-2023 11:55 PM
RickyK
by
New Contributor

 

Hi,

I have a standalone table in which I am inserting the records. After the successful insert I need to display a record or multiple records in the attribute pane for that standalone table. For the same I am using the Select operation on that standalone table.

table.Select(new QueryFilter { ObjectIDs = new List<long> { newObjectId} },
SelectionCombinationMethod.Add)

So I have a custom dock pane that first load the data in that custom UI when selection of  some specific features from the map since dock pane is subscribed to MapSelectionChangedEvent. After that a custom UI can insert a data in my standalone table. After the insertion of the data, I am selecting those new records from that table. 

But since I am adding the selection in the existing selection it is again getting fired by MapSelectionChangedEvent subscription and then again our dock pane code is triggering again. 

Is there a way to select/show those new records in the attribute pane without triggering the MapSelectionChangedEvent again as well as without affecting the current map selection as well. So basically in this specific case, select the records to show the data in attribute pane but don't trigger the MapSelectionChangedEvent again.

@Wolf @UmaHarano  @GKmieliauskas 

3 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Just add a boolean variable in your Module class, let's call it IgnoreSelection

internal class Module1 : Module
{
  private static Module1 _this = null;
  internal static bool IgnoreSelection = false;
...
}

and set the IgnoreSelection to true during your programmatic selection:

Module1.IgnoreSelection = true;
table.Select(new QueryFilter { ObjectIDs = new List<long> { newObjectId } },
			SelectionCombinationMethod.Add);
Module1.IgnoreSelection = false;

and ignore the selection in your selection event handler:

private void OnMapSelectionChanged(MapSelectionChangedEventArgs obj)
{
	if (Module1.IgnoreSelection) return;
	// ...
}

 

KThomasson
Occasional Contributor

Wolf,

    I have a very similar issue I have a tool our team created utilizing the DockpaneModel view, that copies the table records from an existing record and carries over certain attributes from each field.  The only issue is that it does not keep the new records selected which is ideal.  will the above code syntax work for me as well or is there another way to execute this function?

0 Kudos
KThomasson
Occasional Contributor

I have added above code to my code behind but when select the table row and copy the row it doesn't automatically select the new rows that I created.

update:

I was able to get the code to work sorry about the confusion, but now it is selecting all the records instead of just the new records. 

0 Kudos