shesha-io / shesha-framework

An open-source Low-Code development framework for .NET developers. Create .NET based business applications with 80% less code.
https://shesha.io
Apache License 2.0
369 stars 67 forks source link

Autocomplete widget for entity in multiselect mode - returns error once more than one entity selected #2178

Open MarshallRJ opened 4 hours ago

MarshallRJ commented 4 hours ago

Describe the bug When using the Autocomplete widget for an entity in mulitselect mode - The search query returns an error once more than one entity has already been selected.

The query is to the Entities GetAll eg: https://pd-tutorial-api.azurewebsites.net/api/services/app/Entities/GetAll

here is an example of the payload:

skipCount: 0
maxResultCount: 1000
entityType: Shesha.Core.Person
properties: id _displayName
sorting: _displayName
filter: {"in":[{"var":"Id"},[{"id":"9392f2fd-147c-4003-8ed0-dc74960d8169","_displayName":"Bob Smith","_className":"Shesha.Core.Person"},{"id":"4e74ee74-451d-4a78-b03b-bf85998a0fc5","_displayName":"System Administrator","_className":"Shesha.Core.Person"},{"id":"91e45d56-e767-46b3-bc6e-630cec994b6e","_displayName":"","_className":"Shesha.Core.Person"}]]}

Here is the error returned

{
    "result": null,
    "targetUrl": null,
    "success": false,
    "error": {
        "code": 0,
        "message": "Your request is not valid!",
        "details": "The following errors were detected during validation.\r\n - Error trying to resolve field 'personList'.\r\nInner Exception: Failed to parse expression\r\n",
        "validationErrors": [
            {
                "message": "Error trying to resolve field 'personList'.\r\nInner Exception: Failed to parse expression",
                "members": null
            }
        ]
    },
    "unAuthorizedRequest": false,
    "__abp": true
}

To Reproduce

  1. Add an Autocomplete and set it to an entity
  2. Set it to multiselect
  3. Save the form and use the autocomlete
  4. Once more than one entity is selected you should receive the error in the console.

I have configured a from on the tutorial site that replicates the issue:

https://tutorial.shesha.dev/dynamic/ShaCompanyName.ShaProjectName/aaa.form.test

Expected behavior The search should filter and allow more enmities to be searched and selected

Screenshots image

Additional context The error seems to occur regardless of the entity type and is across multiple projects.

MarshallRJ commented 2 hours ago

Update: This can be solved but setting the Autocomplete to use raw values:

image

Closing the issue.

MarshallRJ commented 2 hours ago

Update Reopening the issue: Use raw values solves the issue with the filter, but the binding to the model is now incorrect as now only Id's are returned and not the entity objects.