searchbox

searchbox widget filters for search query in referenced dataset and updates all controls referencing the dataset. It can be easily linked to other controls by referencing the the same dataset.

  • Extends basecontrol
  • Syntax

    <div data-juci="searchbox" data-bind="ref: deliveries" data-searcher="searcher"></div>
    data-bind.ref and data-searcher are mandatory for searchbox.

    Attributes

    • data-juci {String}
      A string with value searchbox.
    • data-search-delay {Number}
      Number of milliseconds after which search can start processing.
    • data-searcher {String}
      Name of function defined on the window scope. Called when a search string is entered in the options list. The function receives the following params,
      • item {Object}
        An item in the options list.
      • searchString {String}
        The searched string.

    Methods

    • clearSearch(bDontFireEvent)
      Clears the searchbox results.
      Parameters:
      • bDontFireEvent
      Fires:
      clear
    • getDelay()
      Gets the current delay before the searchbox can start processing the search string.
      Returns:
      {Number}
    • Searches for the query. This method calls data-searcher to filter the matching results.
      Parameters:
      • val
    • setDelay(delay, bInit)
      Sets a delay before the searchbox can start processing the search string.
      Parameters:
      • delay{Number}
        Delay before search is started, in milliseconds.
      • bInit

    Events

    • aftersearch(eventObj)
      Fires when the search results are ready, but not updated to the dataset.
      Parameters:
      • eventObj{EventObject}
        • data{Array}
          Array of items to be searched.
        • matchingData{Array}
          Array of items matching with the search string.
        • searchedValue{String}
          The search string.
    • beforesearch(eventObj) Cancellable
      Fires before the search processing is started.
      Parameters:
      • eventObj{EventObject}
        • data{Array}
          Array of items to be searched.
        • searchedValue{String}
          The search string.
    • clear(eventObj) Cancellable
      Fires when the searchbox is cleared.
      Parameters:
    • search(eventObj) Cancellable
      Fires when the search results are ready, but not updated to the dataset.
      Parameters:
      • eventObj{EventObject}
        • data{Array}
          Array of items to be searched.
        • matchingData{Array}
          Array of items matching with the search string.
        • searchedValue{String}
          The search string.