arya-blue
luna-amber
luna-blue
luna-green
luna-pink
nova-dark
nova-light
saga-blue
vela-blue
MarkText - Done Callback
Demonstrates the onDone client-side callback, which fires after mark.js completes marking. The callback receives the total number of matches as a parameter.

Compare with the Update Search example: update search uses a server-side p:ajax event="mark" listener that receives full match data (matched terms and positions) via a server round-trip, while this done callback is purely client-side using the onDone attribute with no Ajax request and receives only the total match count.
Search term:
Searchable Content

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Done Callback Result
No search performed yet.
Total matches: 0
Source

                <h:panelGrid columns="2">
        <h:outputText value="Search term:"/>
        <p:inputText id="doneSearchInput" value="#{markTextDoneController.searchTerm}" placeholder="Enter search term"
                     onkeyup="PF('markTextWvDone').updateMark(this.value)"/>
    </h:panelGrid>

    <p:panel id="searchContainer" header="Searchable Content" style="margin-top: 20px">
        <p>#{markTextDoneController.processedText}</p>
    </p:panel>

    <p:panel id="donePanel" header="Done Callback Result" style="margin-top: 20px">
        <h:outputText id="doneLabel" value="No search performed yet." />
        <br/>
        <h:outputText value="Total matches: "/>
        <h:outputText id="doneCount" value="0"/>
    </p:panel>

    <pe:markText id="markText" widgetVar="markTextWvDone" for="searchContainer" value="#{markTextDoneController.searchTerm}"
                 styleClass="marktext-highlight" caseSensitive="false"
                 onDone="markDone(totalMatches)"/>
            
Components and more
Documentation pe:
Attributes (move mouse over the names to see data types)
Name Description
No attributes available for this component.
PrimeFaces Extensions Showcase - © 2011-2025,PrimeFaces: 15.0.17,PrimeFaces Extensions: 15.0.17,JSF: Apache MyFaces JSF-2.3 Core Impl 2.3.10,Server: Apache Tomcat (TomEE)/9.0.82 (8.0.16),Build time: 2026-07-09 20:44