Snippets

Edwin Marshall autosuggest props

Created by Edwin Marshall
{
  "willMountActions": [
    {
      "actionName": "api",
      "api": "GetDropdown",
      "parameters": {
        "api": "GetDropdown",
        "parameters": {
          "system__name": "DINCLNT100",
          "name": "REGIO",
          "_payloadKey": "REGIO"
        }
      }
    }
  ]
}
{
    "suggestions": {
        "root": [
            "payload",
            "GetSalesOrder",
            "dropdowns",
            "REGIO",
            "values"
        ],
        "parent": [
            "user_parameters",
            "HEADER",
            "CITYC"
        ],
        "grandParent": [
            "user_parameters",
            "HEADER",
            "LAND1"
        ]
    }
}

Comments (1)

  1. Edwin Marshall

    Disclaimer #

    This is NOT a working example. Internet is slow and VM crapped out on me, so I wasn't in the mood. Instead, it's meant to give you a sense of the general shape of props when configuring them for autosuggestions.

    Page

    You need to add an api call to page load so that the values you get dropdowns from are populated. The seemingly redundant "parameters" key is necessary to work around how the page component was written in a backward compatible way. The values for the nested parameters were grabbed by comparing them to props Shane gave me, but they seem to correspond to values within a Dropdown model instance. I can walk you through the page on ClearAdmin if you'd like more details

    SmartInput

    The root key is where the array of suggestions is coming from. If that happens to be an object of arrays, you can use parent to pick a specific key in that object to get your values from. If that itself is an object of arrays, you can subsequently use grandParent to pick a key within that object. For 99% of cases, I expect that we'll only need to specify root, though.

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.