Custom Business Foundation Entity List - Delete Item

Vote:
 

Hi,

We're have a custo Business Foundation entity type, and trying to add functionality to the Commerce back-end to allow users to add/edit/delete list items.

We've implemented the list view which is is working fine - and now trying to add a custom handler to delete items. I've implemented the following delete handler:

    public class ExcludedPostcodeDeleteHandler : EcfListViewSelectionHandlerBase
    {
        protected override void ProcessSelectedItems(string[] items)
        {
            for (int index = 0; index < items.Length; ++index)
            {
                string[] keyIdStringItems = EcfListView.GetPrimaryKeyIdStringItems(items[index]);
                if (keyIdStringItems != null && keyIdStringItems.Any())
                {
                    int id;
                    if (int.TryParse(keyIdStringItems.First(), out id))
                        ExcludedPostcodeManager.Current.DeletePostcode(id);
                }
            }
        }
    }

With the command defined in the xml:

				
					{CommerceManager:DeleteSelectedItemsConfirmation}
					ServerAction
          
					panelMainListView
					
				

And the command mapped in the following column definition:

					
						
						
					

However the ID of the selected item is not making it through to the command handler - I get a single item in the array containing an empty string.

Any idea why that might be?

Thanks

#155342
Edited, Sep 14, 2016 12:22
Vote:
 

Found an answer for this- I needed to add this to the databinding code:

           this.MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("ExcludedPostCodeId");

Now it correctly extracts the command argument value.

Web controls, postback, XML files... let's party like it's 1999

#155362
Edited, Sep 14, 2016 18:06
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.