Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You call to the server needs to return a map of the results with the following key names:

  • count: Maps to the count of the total expected number of hits, this is only required for the first call, therefore in your code on the server, it is recommended to check when the start index is 0, you include the count
  • objectList: Maps to the actual list of hits
  • notification: Maps to an informative or error message you wish to display for the user about the results
  • searchAgain: Maps to the phrase against which to search again, when this key is included with a value, the search widget machinery will discard the current results and re run the search against the new specified phrase, a use case for this is if there are no matches to what the user originally entered and you wish to send them back results based on a shorter phrase

Next thing is to initialize the widget and there are 2 ways to do it, the one used above is the one which delegates to a helper function that takes in 5 6 arguments, in the case above, the first argument is the arguments are;

  • elementId: the id of the element that will be the container of the widget
  • showIncludeVoided: bool (default: false) - Specifies whether the 'includeVoided' checkbox and label should be displayed
  • searchHandler: function(text, resultHandler, options) (default:null) The function to be called to fetch search results from the server
  • selectionHandler: function(index, rowData)
  • fieldsAndHeaders: Array of fieldNames and column header maps
  • otherOptions: Array of mappings between the property names and their corresponding values, see below for the complete list of widget properties under the 'Widget properties' section

the id of the element inside which the widget should be embedded, the rest of them are configuration properties that are explained below under the 'widget properties' section.

Below is the other way of how to initialize the widget:

...

  • minLength: int (default: 1) The minimum number of characters required to trigger a search, this is ignored if 'doSearchWhenEmpty' is set to true
  • searchLabel: string (default: omsgs.searchLabel) The text to be used as the label for the search textbox
  • includeVoidedLabel: string (default: omsgs.includeVoided) The text to be used as the label for the 'includeVoided' checkbox
  • showIncludeVoided: bool (default: false) - Specifies whether the 'includeVoided' checkbox and label should be displayed
  • includeVerboseLabel: string (default: omsgs.includeVerbose) The text to be used as the label for the 'includeVerbose' checkbox
  • showIncludeVerbose: bool (default: false) Specifies whether the 'includeVerbose' checkbox and label should be displayed
  • searchHandler: function(text, resultHandler, options) (default:null) The function to be called to fetch search results from the server
  • resultsHandler: function(results) (default:null) The function to be called
  • selectionHandler: function(index, rowData)
  • fieldsAndHeaders: Array of fieldNames and column header maps
  • displayLength: int (default: 10)
  • columnWidths: an array of column widths, the length of the array should be equal to the number of columns, should be of the same length as the number of columns
  • columnRenderers: array of fnRender(s) for each column, should be of the same length as the number of columns, set a value of null for columns with no renderers
  • columnVisibility: array of bVisible values for each column, true/false are the only possible values in the array and should be of the same length as the number of columns
  • initialData: (default: null) The initial data to be displayed e.g if it is an encounter search, it should be an encounter list
  • searchPhrase: string The phrase to be set in the search box so that a search is triggered on page load to display initial items
  • doSearchWhenEmpty: string (default:false): If it is set to true, it lists all items initially and filters them with the given search phrase.
  • verboseHandler: function to be called to return the text to display as verbose output