WebSite-PHP Framework PHP
Multi langues
Mode Ajax simple
Aucun HTML, aucun JavaScript
URL rewrinting
Envoi d'email
Sitemap - RSS - Web service
Télécharger le Framework WebSite-PHP maintenant
 


Loading
 


Tutorial : TextBox search 
with autocomplete and dynamic filter

Tutoriels

>

Tutoriel Textbox

>

Tutorial : TextBox search with autocomplete and dynamic filter


Textbox-09: Tutoriel du composants Textbox du FrameWork PHP WebSite-PHP.

Tutorial : TextBox search with autocomplete and dynamic filter:



Retourner aux tutoriels du composants Textbox



Code source

Code source


Fichier: /pages/tutorials/textbox/textbox-09.php

<?php
class Textbox09 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : TextBox search 
                    with autocomplete and dynamic filter"
;
        
        
$form = new Form($this);
        
        
// Create ComboBox object (filter)
        // List of actif and inactif is available on:
        // http://www.website-php.com/en/tutorials/database/database-05.html
        // You can modify the list of inactif on:
        // http://www.website-php.com/en/tutorials/database/database-07.html
        
$filter = new ComboBox($form);
        
$filter->addItem(1"ACTIF");
        
$filter->addItem(0"INACTIF");
        
        
// Create TextBox object
        
$search_text = new TextBox($form);
        
        
// Create AutoCompleteEvent object
        
$autocompete_event = new AutoCompleteEvent($form);
        
$autocompete_event->onSelect("onSelectAutoComplete");
        
$autocompete_event->setAjaxEvent();
        
$autocompete_event->disableAjaxWaitMessage();
        
        
// Create AutoComplete object (with filter in the URL)
        
$autocomplete = new AutoComplete(
            new 
Url("xml/textbox-search.json?".
            
"filter='+$('#".$filter->getId()."').val()+'"), 
            
1$autocompete_event);

        
// Refresh URL when change filter
        
$filter->onChangeJS("$('#".$search_text->getId()."').autocomplete(".
            
"'option', 'source', '".$this->getBaseLanguageURL().
            
"xml/textbox-search.json?".
            
"filter='+$('#".$filter->getId()."').val());");
            
        
// Set autocomplete on the TextBox
        
$search_text->setAutoComplete($autocomplete);
        
$form->setContent(new WSPObject($filter$search_text));
        
        
$this->render $form;
    }
    
    public function 
onSelectAutoComplete($sender$id) {
        
$this->addObject(
            new 
DialogBox("onSelectAutoComplete"
                                
"URL: ".$id)
            );
    }
}
?>


Retourner aux tutoriels du composants Textbox



Share

 


Copyright © 2009-2024 WebSite-PHP Framework PHP
Accueil Documentation Télécharger Quick start Tutoriels Wiki Issue Tracker