X

The Visual Builder Cloud Service Blog

Search Across Multiple Columns in a SelectSingle

Shay Shmeltzer
Director of Product Management - Oracle

The new oj-selectSingle component is the recommended component for selection lists in Visual Builder starting with version 20.10. In past blog entries we showed you some of the advance features it offers such as advanced layouts and retrieving additional values beyond just the label. In this blog we show you one more capability - searching for a value across multiple columns in the list. 

To achieve this capability you'll need to populate your singleSelect using an Array Data Provider - this keeps the records fetched on the client, and enables you to search across the array of data.

Array Data Provider has an attribute called textFilterAttributes that you can specify in its definition and will contain an array listing the fields that you want to allow searching on (make sure they are fetched when you populate the ADP). One tricky part, right now, is that we don't expose the textFilterAttributes attribute in the VB design time, so you need to switch into code view the page's json file, locate the variable definition, and update it directly there. You can see an example of this in the JET cookbook here, and the code I specifically used for the JSON file is:

  "variables": {
    "myADP": {
      "type": "vb/ArrayDataProvider2",
      "defaultValue": {
        "itemType": "get_Employees2",
        "keyAttributes": [
          "id"
        ],
        "textFilterAttributes": ["name","salary","country"]
      }
    }
  }

In the demo I rely on the piece of code that displays a complete table of columns and rows for the list. You can pick it up from the blog titled -  Advanced Layouts in Single Select Components. Note that you don't have to show the fields you are searching on, it's just a better user experience.

Here is the full development process to achieve this:

Join the discussion

Comments ( 2 )
  • Sourav Monday, December 7, 2020
    I implemented the same using ADP and ORDS based SDP.
    For ADP it worked fine. But for SDP the filter is not working.
  • Shay Shmeltzer Monday, December 7, 2020
    Sourav - this is a client side search, SDP doesn't maintain a client collection of the results so this won't work with SDP - you need an ADP.
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.