U4-10769 - ListViewHelper doesn't select/deselect correct when not having key property

Created by Bjarne Fyrstenborg 18 Dec 2017, 13:46:26 Updated by Sebastiaan Janssen 25 Jul 2018, 12:43:21

Tags: PR

Relates to: U4-10720

Relates to: U4-10749

I have created a custom dashboard to list orders, when paged results and the option to filter by order status, search for orders with a specific sku in the order line.

For this purpose I use the umb-table Angular directive/component (which also is used in listviews). Furthermore I use listViewHelper to select/deselect items.

However when the object/item in the array doesn't have a property "key" (and maybe when this property value is null or undefined) it doesn't select the items correct. In this case I can only select a single item (where it think all items are selected since the checkbox in table header is selected although only 1 item is pushed to the selection array and 1 row/item has the checkmark icon).

I can select multiple items if I select all and then deselect items.

Previously my the objects only had properties like "id", "name" and additional properties like "customer", "status", orderTotal" etc.

I had a look at the source code and it seems to expect the "key" property. https://github.com/umbraco/Umbraco-CMS/blob/6a74967a499a464b1b2274518c0e5381d866438f/src/Umbraco.Web.UI.Client/src/common/services/listviewhelper.service.js#L268-L281

I think the select/deselect funtions fails, when the object doesn't have a key property.

After I added the following "Key" property to my serverside model, the selection work as expected and the property is populated with an OrderGuid value.

[DataMember(Name = "key")]
public string Key { get; set; }

But the documentation doesn't mention anything about that. https://our.umbraco.org/apidocs/ui/#/api/umbraco.services.listViewHelper

I think it should also be possible to use umb-table + listViewHelper just with an "id" property.

Finally it would be great to document the umb-table component. http://issues.umbraco.org/issue/U4-10720

2 Attachments

Comments

Bjarne Fyrstenborg 18 Mar 2018, 22:19:52

PR: https://github.com/umbraco/Umbraco-CMS/pull/2521


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted: Pull request

Affected versions: 7.7.6, 7.7.7

Due in version: 7.12.0

Sprint:

Story Points:

Cycle: