jQWidgets Forums
jQuery UI Widgets › Forums › Getting Started › Drop down list
Tagged: jqxDropDownList
This topic contains 3 replies, has 4 voices, and was last updated by Peter Stoev 6 years, 10 months ago.
-
AuthorDrop down list Posts
-
Hello, I have a problem about a rolling list. I would like to display the data present in my database in this drop-down list when we start writing in it. Here is my display file.
<?php
Function MainFunction()
{
//Titre de la page
TitrePage(“Arrivee du module”);
Echo ‘<br></br>’;// FORMULAIRE
Echo ‘<center><form name=”form1″ action=”modules.php” method=”get” >’ ;
// MODULE DE SAISIE FORMULAIRE
// Ouverture de la table du formulaire
Echo “<script type=’text/javascript’>
$(document).ready(function()
{
var theme = ‘renault’;
//Preparation des données
var url = ‘modules/g_produits/data.php’
var source =
{ datatype : ‘json’ ,
datafields : [{ name : ‘id mac’ ,type: ‘int’},
{name: ‘matricule_mac’ ,type: ‘string’}],
url : url
};
var dataAdapter = new $.jqx.dataAdapter(source);
editor.jqxDropDownList({ theme : ‘black’ ,
dropDownHeight : 80 ,
animationType : ‘fade’ ,
placeHolder : ‘Privilége’ ,
source : dataAdapter ,
displayMember : ‘lib’ ,
valueMember : ‘cod’
});
)};
</script>”;
//EXECUTION DU MODULE
Function RunModule()
{
Global $modname ,
$op ,
$CurrentProfil ;//——————-
//AIGUILLEUR GENERALE OPERATION
switch ( $op )
{
default :
MainFunction() ;
Break ;
} ;
//FIN AIGUILLEUR GENERALE OPERATION
//———————-
} ;
//——————————
?>and here is my data loading file :
<?php
Session_start() ;include ‘../../config.php’ ;
include ‘../../mainfile.php’ ;
include ‘../../includes/class.arca.php’ ;// CONNECTION DATABASE
ConnectDB() ;// CHAGEMENT DE LA SESSION
$CurrentProfil = ( isset( $_SESSION[“WKFPRS_CurrentProfil”]) ) ? $_SESSION[“WKFPRS_CurrentProfil”] : array( ‘res’=>’0’ , ‘ipn’=>” ) ;
$c_ipn = $CurrentProfil[‘ipn’] ;// CONSTRUCTION DE LA REQUETE SQL
$QuerySelect = “select id_mac, matricule_mac ” ;$QueryFrom = ” from machines ” ;
$QuerySort = ” order by matricule_mac ” ;
// CONSTITUTION DE LA REQUETE
$query = “$QuerySelect $QueryFrom $QuerySort ;” ;// ÉXÉCUTION DE LA REQUETE
$result = $db->prepare( $query ) ;
$result->execute() ;
$Rows = Array() ;
While( $row = $result->fetch( PDO::FETCH_OBJ) )
{
$Rows[] = array ( ‘id_mac’ => $row->id_mac ,
‘matricule_mac’ => $row->matricule_mac ) ;} ;
$result = $db->prepare( $query ) ;
$result->execute() ;
$TotalRows = $result->rowCount();// FINALISATION
$ToSend[] = array( ‘TotalRows’ => $TotalRows ,
‘Rows’ => $Rows ) ;// RENVOI DES DONNEES –> JSON
Echo json_encode( $ToSend ) ;// FERMETURE DB
DisConnectDB() ;
?>Thank.
Hello lvdkevin,
If you want to be able to search through your DB using a drop down, I would suggest you use our widget ‘jqxComboBox‘.
It has a built-in filtering functionality.
Best Regards,
StanislavjQWidgets Team
http://www.jqwidgets.com/Uncaught TypeError: Cannot read property ‘label’ of null
Please help on this issue ?Hi bhavin458,
Please, share a sample code which demonstrates this.
Regards,
Peter -
AuthorPosts
You must be logged in to reply to this topic.