IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Ext JS / Sencha Discussion :

Afficher les données de ma base mysql dans une grille via un formulaire de recherche


Sujet :

Ext JS / Sencha

  1. #1
    Nouveau membre du Club
    Inscrit en
    Août 2007
    Messages
    32
    Détails du profil
    Informations forums :
    Inscription : Août 2007
    Messages : 32
    Points : 26
    Points
    26
    Par défaut Afficher les données de ma base mysql dans une grille via un formulaire de recherche
    salut
    j'aimerais afficher les données de ma base mysql dans une grille via un formulaire de recherche voici mon
    code js
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    		Ext.onReady(function()
    			{
    				Ext.QuickTips.init();
    				Ext.form.Field.prototype.msgTarget = 'qtip';
     
    				var Frm = new Ext.FormPanel(
    						{
    								iconCls 	: Ext.ux.iconMgr.getIcon('js/png/', 'abn.png'),
    								id 			: 'Frm',
    								title 		: 'Abonnement Client',
    								bodyStyle	: 'padding : 0px 0px 0px 0px',
    //	style : 'border : 2px dashed;', 								
    								frame		: true,
    								width		: 552,
    							//	autoWidth	: true,
    								url			: 'abonnement.php?iFrm=&vFrm=Yes',
    								monitorValid 	: true,	
    								bodyCfg 	: {tag:'center', cls:'x-panel-body'},
    								style 		: 'margin : 0px auto 0px auto;',							
    								buttonAlign : 'center',
    								items		: 
    									[
    										{
    											layout	: 'column',	 
    //	style : 'border : 1px dashed;',
    											items	: 
    												[
    													{
    														style 		: 'margin : 0px 5px 0px 3px; padding:0px 0px 0px 0px',
    														layout		: 'form',						
    														width 		: 265,
    														items		: 
    															[
    																{
    //	style : 'border : 1px dashed;', 								
    																	xtype		: 'fieldset',
    																	title		: 'Compte Client',
    																	width 		: 262,
    																	autoHeight	: true,
    																//	autoWidth 	: true,
    																	defaults	: {labelStyle:'font-size:8pt; text-align:right;', labelSeparator:' :'},
    																	items		: 
    																		[
    																			{
    																				xtype			: 'numberfield',
    																				fieldLabel		: 'Code Client',
    																				name			: 'Code',
    																				width			: 135,
    																				height 			: 22,
    																				allowDecimals 	: false,
    																				allowNegative 	: false,
    																				nanText   		: 'Veuillez saisir une chaîne numérique'
    																			},{
    																				xtype			: 'textfield',
    																				fieldLabel		: 'Code d\'Agence',
    																				name			: 'Agence',
    																				width			: 135,
    																				height 			: 22
    																			},{
    																				xtype			: 'numberfield',
    																				fieldLabel		: 'Numéro de Compte',
    																				name			: 'Compte',
    																				width			: 135,
    																				height 			: 22,
    																				allowDecimals 	: false,
    																				allowNegative 	: false,
    																				nanText   		: 'Veuillez saisir une chaîne numérique'
    																			}
    																		]
    																}
    															]
    													},{
    														width 		: 265,
    														layout		: 'form',						
    														items		: 
    															[
    																{
    																	xtype		: 'fieldset',
    																	width 		: 262,
    																	title		: 'Information sur le Client',
    																	defaults	: {labelStyle:'font-size:8pt; text-align:right;', labelSeparator:' :'},
    																	items		: 
    																		[
    																			{
    																				xtype			: 'textfield',
    																				fieldLabel		: 'Nom du Client',
    																				name			: 'Nom',
    																				width			: 135,
    																				height 			: 22 
    																			},{
    																				xtype			: 'datefield',
    																				format 			: "d/m/Y",
    																				fieldLabel		: 'Date Naissance',
    																				name			: 'Date',
    																				width			: 135,
    																				height 			: 22 
    																			},{
    																				xtype			: 'textfield',
    																				fieldLabel		: 'Numéro Téléphone',
    																				name			: 'Phone',
    																				width			: 135,
    																				height 			: 22 
    																			}
    																		]
    																}
    															] 
    													}
    												]
    										}
     
    									],
     
    									 buttons: [
      {
        text: 'Rechercher',
        handler: function(){
           modalWin.destroy();
        }
      }]								
    						});
     
    				var proxy = new Ext.data.HttpProxy(
    					{
    						api	: 
    							{
    								read : 'abn_clt.php'
    							}			
    					});				   
     
    				var reader = new Ext.data.JsonReader(
    					{
    					    totalProperty	: 'total',
    					    successProperty	: 'success',
    					    idProperty		: 'Code',
    					    root			: 'results',
    					    messageProperty	: 'message'
    					},[
    					    {name : 'Code'},
    					    {name : 'Client'},
    					    {name : 'DateNai', type : 'date', dateFormat : 'Y-m-d'},
    					    {name : 'Adresse'},
    					    {name : 'Phone'}
    					]);
     
    				var writer = new Ext.data.JsonWriter(
    					{
    					    writeAllFields 	: true,
    						encode			: false
    					});
     
    				var store = new Ext.data.Store(
    					{
    					    id		: 'Client',
    					    restful	: false,
    					    proxy	: proxy,
    					    reader	: reader,
    					    writer	: writer
    					});
     
    				store.load();
     
    				var Lst_Clt =  
    					[
    						new Ext.grid.RowNumberer(),
    						{header : "Code Client",	width : 50,  sortable : true, dataIndex : 'Code', 		align : 'center'},
    						{header : "Nom & Prénoms", 	width : 180, sortable : true, dataIndex : 'Client', 	align : 'left'},
    						{header : "Date Naissance", width : 70,  sortable : true, dataIndex : 'DateNai', 	align : 'center', renderer : Ext.util.Format.dateRenderer('d/m/Y')},
    						{header : "Adresse", 		width : 140, sortable : true, dataIndex : 'Adresse', 	align : 'left'},
    						{header : "Téléphone", 		width : 50,  sortable : true, dataIndex : 'Phone', 		align : 'center'}
    					];
     
     
    			    function toggleDetails(btn, pressed)
    					{
    						/*
    				        var view = grid.getView();
    				        view.showPreview = pressed;
    				        view.refresh();
    						*/
    				    }
    				/** 
    	             * Paging Plugin
    	             * Author = devnull / modified by Andrie
    				 */
    				var pagingPlugin = new Ext.ux.Andrie.pPageSize(
    										{
    											afterText : '   Ligne(s)'
    										});
     
    				/*var filters = new Ext.ux.grid.GridFilters(
    										{						//	need to specify if want local filtering (filter the store), otherwise defaults to server side filtering
    											local	: true,		//	specify true if you want to filter client side
    											filters	:
    												[
    										            {dataIndex: 'Code',   	type: 'numeric'},
    										            {dataIndex: 'Client', 	type: 'string'},
    										            {dataIndex: 'DateNai', 	type: 'date'},
    										            {dataIndex: 'Adresse', 	type: 'string'},
    										            {dataIndex: 'Phone', 	type: 'string'}
    												]
    										});*/
     
    			    var Grid = new Ext.grid.GridPanel(
    					{
    						id			: 'Grid',
    						iconCls		: Ext.ux.iconMgr.getIcon('js/png/', 'abn_clt.png'),
    						frame		: true,
    						title		: 'Liste des Clients',
    						autoScroll	: true,
    						height		: 300,
    					//	autoHeight	: true,
    						store		: store,
    						columns 	: Lst_Clt,
    				        viewConfig	: 
    							{
    					            forceFit : true
    					        },
    			            bbar		: new Ext.PagingToolbar(
    										{
    								            plugins		: [pagingPlugin],//, filters],
    							                pageSize	: 20,
    							                store		: store,
    							                displayInfo	: true,
    							                displayMsg	: '{0} à {1} sur {2}   ',
    							                emptyMsg	: ' Aucun Résultat '
    							/*,
    							                items		:
    												[
    								                    '-', 	{
    											                    pressed			: true,
    											                    enableToggle	: true,
    											                    text			: 'Show Preview',
    											                    cls				: 'x-btn-text-icon details',
    											                    toggleHandler	: toggleDetails  
    								                			}
    												]
    							*/
    							            })
    					});
     
     
     
    				var Grd_Frm = new Ext.FormPanel(
    						{
    								iconCls 	: Ext.ux.iconMgr.getIcon('js/png/', 'abn_lst.png'),
    								id 			: 'Frm',
    								title 		: 'Résultat de Recherche',
    								bodyStyle	: 'padding : 0px 0px 0px 0px',
    //	style : 'border : 2px dashed;', 								
    								frame		: true,
    								width		: 700,
    							//	autoWidth	: true,
    							//	url			: 'abonnement.php?iFrm=&vFrm=Yes',
    								monitorValid 	: true,	
    								bodyCfg 	: {tag:'center', cls:'x-panel-body'},
    								style 		: 'margin : 0px auto 0px auto;',							
    								buttonAlign : 'center',
    								items		: 
    									[ 
    										Grid
    									]
    						});
     
    					/*var Win = new Ext.Window( 
    						{
    							iconCls 	: Ext.ux.iconMgr.getIcon('js/png/', 'gestion_abn.png'),
    							title		: 'Gestion des Abonnemments',
    							id			: 'Frm_Win',
    							bodyStyle	: 'padding:5px',
    							width		: 565,
    						//	autoHeight 	: true,								
    						//	height 		: 597,
    							closable 	: false,
    							closeAction : 'hide',
    							resizable 	: false,
    							frame		: true,
                                draggable	: false,
    							items 		: 
    								[ 
    									Frm
    								]
    						});*/
     
    					Frm.render('Abn_Clt');
     
    					Grd_Frm.render('Grd_Frm');
     
    					///*Frm.render('Frm_Search');*/
    				});

    code php

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    <?php
     
     
     
            session_start();
            
            include('./connexion/inc_con.php');
            
            if (!isset($_SESSION['Code']))
                    {
                            header("Location: index.php");
                            exit; 
                    }
                    
    ?> 
     
    <?php
     
       
            //      $Start = (integer) (isset($_POST['Start']) ? $_POST['Start'] : $_GET['Start']);
            //      $End   = (integer) (isset($_POST['Limit']) ? $_POST['Limit'] : $_GET['Limit']);  
                    $Start = 1;
                    $End   = 100;  
                    
                    $Sql_Count      = 'Select Id_Client As Code, Trim(Concat_Ws(" ", Trim(Nom), Trim(Prenom))) As Client, Left(Date_Naissance, 10) As DateNai, Trim(Adresse) As Adresse, Trim(Num_Tel) As Phone From Client_Cnce ';
                    $Sql            = $Sql_Count . ' Limit ' . $Start . ', ' . $End;
            //      echo $Sql;
            //      $Result_Count   = mysql_query('Select Id_Client From Client_Cnce');
            //      $Rows                   = mysql_num_rows($Result_Count);                        
                    $Rows                   = 0;                    
                    $Result                 = mysql_query($Sql);
                            
                    while($Rec = mysql_fetch_array($Result, MYSQL_ASSOC))
                            {
                                    
                                    $Arr[] = $Rec;
                            };
                                    
            $Data = json_encode($Arr);
                    
                    echo '{"total" : "' . $Rows . '", "results" :' . $Data . '}';
                    
    ?>
    code tml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <!-- saved from url=(0014)about:internet -->
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>accueil.gif</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
    td img {display: block;}.Style11 {font-family: Arial, Helvetica, sans-serif;
    	font-weight: bold;
    	font-size: 11px;
    }
    .Style6 {	font-family: Arial, Helvetica, sans-serif;
    	font-size: 10px;
    	font-weight: bold;
    	color: #666666;
    }
    </style>
    <!--Fireworks CS3 Dreamweaver CS3 target.  Created Thu Feb 04 09:34:44 GMT+0000 (GMT) 2010-->
    </head>
    <body bgcolor="#ffffff">
    <div align="center">
      <table border="0" cellpadding="0" cellspacing="0" width="900">
        <!-- fwtable fwsrc="ABONNEMENT-Accueil DECOUPE.png" fwpage="Page 1" fwbase="accueil.gif" fwstyle="Dreamweaver" fwdocid = "1863545446" fwnested="0" -->
        <tr>
          <td><img src="images/spacer.gif" width="63" height="1" border="0" alt="" /></td>
          <td><img src="images/spacer.gif" width="163" height="1" border="0" alt="" /></td>
          <td><img src="images/spacer.gif" width="397" height="1" border="0" alt="" /></td>
          <td><img src="images/spacer.gif" width="72" height="1" border="0" alt="" /></td>
          <td><img src="images/spacer.gif" width="142" height="1" border="0" alt="" /></td>
          <td><img src="images/spacer.gif" width="63" height="1" border="0" alt="" /></td>
          <td><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td>
        </tr>
     
        <tr>
          <td colspan="2"><img name="accueil_r1_c1" src="images/accueil_r1_c1.gif" width="226" height="179" border="0" id="accueil_r1_c1" alt="" /></td>
          <td colspan="2"><img name="accueil_r1_c3" src="images/accueil_r1_c3.gif" width="469" height="179" border="0" id="accueil_r1_c3" alt="" /></td>
          <td colspan="2"><img name="accueil_r1_c5" src="images/accueil_r1_c5.gif" width="205" height="179" border="0" id="accueil_r1_c5" alt="" /></td>
          <td><img src="images/spacer.gif" width="1" height="179" border="0" alt="" /></td>
        </tr>
        <tr>
          <td colspan="3"><img name="accueil_r2_c1" src="images/accueil_r2_c1.gif" width="623" height="40" border="0" id="accueil_r2_c1" alt="" /></td>
          <td colspan="3"><img name="accueil_r2_c4" src="images/accueil_r2_c4.gif" width="277" height="40" border="0" id="accueil_r2_c4" alt="" /></td>
          <td><img src="images/spacer.gif" width="1" height="40" border="0" alt="" /></td>
        </tr>
        <tr>
          <td colspan="6"><img name="accueil_r3_c1" src="images/accueil_r3_c1.gif" width="900" height="51" border="0" id="accueil_r3_c1" alt="" /></td>
          <td><img src="images/spacer.gif" width="1" height="51" border="0" alt="" /></td>
        </tr>
        <tr>
          <td valign="top" background="images/accueil_r4_c1.gif">&nbsp;</td>
          <td colspan="4" valign="top" background="images/accueil_r4_c2.gif"><p>&nbsp;</p></td>
          <td valign="top" background="images/accueil_r4_c6.gif">&nbsp;</td>
          <td><img src="images/spacer.gif" width="1" height="497" border="0" alt="" /></td>
        </tr>
        <tr>
          <td colspan="6" background="images/accueil_r5_c1.gif"><div align="center">
            <div align="center" class="Style6">
              <div align="center" class="Style6"><span class="Style11">Copyright © 2009 Caisse d'Epargne - Accueil -<a href="http://www.caissepargne.ci">Site Institutionnel</a> - Contacts</span></div>
            </div>
          </div></td>
          <td><img src="images/spacer.gif" width="1" height="33" border="0" alt="" /></td>
        </tr>
      </table>
    </div>
    </body>
    </html>

  2. #2
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    1
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 1
    Points : 1
    Points
    1
    Par défaut
    slt,
    j'ai le probleme je voudrais savoir si c'est resolu pour toi???si oui merci bien de me guider dans ton code!!

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Février 2010
    Messages
    267
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2010
    Messages : 267
    Points : 330
    Points
    330
    Par défaut
    salut Paula,

    déja, ton code est difficile a lire ...
    1ier question ... est ce que tu arrives a afficher des résultat dans ta grid? la question est simplement de savoir si le pb vient de ton formulaire ou de ta grid ...

    il faudrait essayer de trouver l'origine du pb ...

Discussions similaires

  1. Réponses: 1
    Dernier message: 29/06/2015, 14h41
  2. Afficher les données de ma base MySql
    Par sadigoun dans le forum Développement Web en Java
    Réponses: 2
    Dernier message: 31/05/2011, 19h38
  3. [MySQL] Importer les données d'un fichier CSV dans une base de données
    Par joueur dans le forum PHP & Base de données
    Réponses: 7
    Dernier message: 12/11/2008, 11h59
  4. Réponses: 2
    Dernier message: 13/10/2008, 14h39
  5. Réponses: 3
    Dernier message: 27/07/2007, 13h06

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo