[SalesForce] reset to call a controller

I using the search type input in a lightning component to do a dynamic search on a given field from a custom object. I've noticed when you click on the "X" to clear the data that came back from the search that there doesn't seem to be a way to recall the main controller so that the entire data set is retrieved again.

Here's the way I have the input type setup.

        <lightning:input type="search"
            aura:id="searchinput"
            label="{!v.fieldLabel}"
            name="{!v.fieldLabel}"
            value=""
            onchange="{!c.searchRecords}"
            isLoading="false"
            placeholder="{!v.placeholder}"
            onfocus="{!c.searchRecords}"
            onblur="{!c.searchRecords}"/>

The onchange is working correctly, but onblur (not idea to have to click off the list) doesn't seem to be working correctly. Has anyone else run into this?

Best Answer

Personally, I'd set a handler on the search term itself:

<aura:attribute name="searchTerm" 
                type="String" />
<aura:handler name="change" 
              value="{!v.searchTerm}" 
              action="{!c.searchRecords}" />
<lightning:input value="{!v.searchTerm}" 
                 type="search"
                 label="{!v.fieldLabel}"
                 name="{!v.fieldLabel}" 
                 placeholder="{!v.placeholder}" />