7.1

Table Of Contents
)
)
Adding a live search option
This example demonstrates a live search, where you get search results while you type. An event is triggered when the user
presses, and releases a key in the input field. When the event is triggered, a Javacscript function is executed. The result of this
function is used to update a placeholder element on the web page. The function performs an AJAX request to retrieve the doc-
ument list from the database. AJAX (Asynchronous JavaScript and XML) is a method of building interactive applications for the
Web that process user requests immediately.
To install the sample copy the template-storefront_overview.php from the storefront_tree_livesearch folder to the root of the
default skin.
The tree view with a search block.
This sample constists of the following parts:
l Store front specific template file (exception file). The template file contains links to external JavaScript files and some
custom HTML code for the search and tree areas.
l An php file that retrieves the document list. The result set is used to generate the HTML for the tree. This file is called
by a custom Javascript function in the <head> section of the template file. This functions calls this php file using an
AJAX request.
The Javascript file
This is the JavaScript code stored in the file "livesearch.js":
$(document).ready( function(){
getTree();
generateTree();
©2010 Objectif Lune Inc - 260 -