1. #791
    Sencha Premium Member
    Join Date
    Mar 2010
    Posts
    63
    Vote Rating
    0
    LostSoul is on a distinguished road

      0  

    Default


    your store
    Code:
    var regionsDataReader = new Ext.data.JsonReader({root: 'results'},regionsDataRecord);
     
    var regionsDataProxy = new Ext.data.HttpProxy({url: 'backend/js_listRegions', method: 'POST'});
     
    var regionsDataStore = new Ext.data.Store({
        proxy: regionsDataProxy, 
        reader: regionsDataReader
    });
    your code
    Code:
    plugins:[new Ext.ux.grid.Search({
                    iconCls:'icon-zoom',
                    minChars:3,
                    autoFocus:true
                })]
    my additions
    Code:
    plugins:new Ext.ux.grid.Search({
                    store: regionsDataStore,
                    id: 'searchPanel',
                    iconCls:'icon-zoom',
                    minChars:3,
                    autoFocus:true
                })
    try adding the store and the id to your plugin, also i don't think the [] around it is needed
    Last edited by LostSoul; 29 Apr 2010 at 1:10 PM. Reason: forgot a comma

  2. #792
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,561
    Vote Rating
    384
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Sorry, I do not have enough time to debug your application. I don't think that it's a problem in the Search plugin so my advice from the above code still applies. Make the example running in your environment (w/o any change), then change something to see when it stops working. Do it in small steps.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  3. #793
    Sencha Premium Member
    Join Date
    Mar 2010
    Posts
    63
    Vote Rating
    0
    LostSoul is on a distinguished road

      0  

    Default


    jack not sure if that reply was at me, I was posting trying to help the guy that posted before you. sry if there was confusion

  4. #794
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,561
    Vote Rating
    384
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    No problem - sorry if I haven't noticed that - I have too many posts to answer.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  5. #795
    Ext User
    Join Date
    Feb 2010
    Posts
    29
    Vote Rating
    0
    Vepe is on a distinguished road

      0  

    Default


    Great plugin!!!! Really what I needed =D!

    But...(there is always one XD)

    You use regular expressions to search, so... if I want to search for a special character like | or * I have to use \|, \* =P
    Not a big deal, but it is something that I noticed

    Put this at the doc =D!

  6. #796
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,561
    Vote Rating
    384
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    That depends on server side; how it handles special characters.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  7. #797
    Ext User
    Join Date
    Feb 2010
    Posts
    29
    Vote Rating
    0
    Vepe is on a distinguished road

      0  

    Default


    ops! =P... true story XD

    Thanks =D

  8. #798
    Ext User
    Join Date
    May 2010
    Posts
    3
    Vote Rating
    0
    Rbn_3d is on a distinguished road

      0  

    Default


    Hi, I have a problem, the search reloads the store, but whitout any changes.

    The search are remote, and it´s managed fron php. I know the final query works, because it´s writed in a log and works in phpmyadmin.

    I have this code on grid.js:

    Code:
    var store_entrada = new Ext.data.JsonStore({  
            id: 'store',
            totalProperty: 'results',
            proxy: new Ext.data.HttpProxy({  
                        url: 'ext/json_entrada.php',  
                        method: 'POST'}),
            autoLoad:true,
            remoteSort:true,
            root: 'rows',
            fields: [
                {name:'id'},
                {name:'fecha_entrada'},
                {name:'no_orden_entrada'},
                {name:'year'},
                {name:'procedencia'},
                {name:'remitente'},
                {name:'clase_doc'},
                {name:'extracto'},
                {name:'observaciones'},
                {name:'url'}
                    ],
        });  
    
    
        // Pagging toolbar para el grid (Entrada), para cargar solo los  registros necesarios al trabajar con gran cantidad de datos...
            var paging_entrada = new Ext.PagingToolbar({  
                pageSize: 100,  
                store: store_entrada,  
                displayInfo: true,
                displayMsg: 'Mostrando de {0} a {1}, ({2} en total)',
                emptyMsg: "No hay resultados",
                beforePageText:"Pagina",
                afterPageText:"de {0}",
                firstText:"Primera pag.",
                prevText:"Anterior",
                nextText:"Siguiente",
                lastText:"Ultima",
                refreshText:"Refrescar"    
            });
    
        // create the Grid
        var grid_entrada = new Ext.grid.GridPanel({
            store: store_entrada,
            columns: [
                {id:'id',header: 'ID', width: 20, sortable: true, dataIndex:  'id'},
                {header: 'Fecha de entrada', width: 85, sortable: true,  dataIndex: 'fecha_entrada'},
                {header: 'Orden de entrada', width: 85, sortable: true,  dataIndex: 'no_orden_entrada'},
                {header: 'Year', width: 85, sortable: true, dataIndex:  'year'},
                {header: 'Procedencia', width: 85, sortable: true,  dataIndex: 'procedencia'},
                {header: 'Remitente', width: 85, sortable: true, dataIndex:  'remitente'},
                {header: 'Clase Documento', width: 85, sortable: true,  dataIndex: 'clase_doc'},
                {header: 'Extracto', width: 85, sortable: true, dataIndex:  'extracto'},
                {header: 'Observaciones', width: 85, sortable: true,  dataIndex: 'observaciones'},
                {header: 'Descarga', width: 85, sortable: true, dataIndex:  'url'}
            ],
            stripeRows: true,
            autoExpandColumn: 'id',
            height: 305,
            width: 715,
            title: 'Entrada: Todos los registros',
            // config options for stateful behavior
            stateful: true,
            stateId: 'grid',
            bbar: paging_entrada,
            plugins: [new Ext.ux.grid.Search({
                        iconCls:'icon-zoom',
                        readonlyIndexes:['note'],
                        disableIndexes:['pctChange'],
                        minChars:3,
                        autoFocus:true,
                        searchText: 'Buscar',
                        mode: 'remote',
                        dateFormat: 'd m Y H:i',
                        position: 'bottom'
                    })]
        });
    This is the php-json that's handle the store:

    Code:
    <?php
    //header('Content-type: application/json');  // this is the magic that  sets responseJSON
     
    // Connecting, selecting database
    $link = mysql_connect("localhost", "root", "")
        or die('Could not connect: ' . mysql_error());
    mysql_select_db("registros") or die('Could not select database');
     
    //Codigo para obtener nombre y valor de todas las variables que llegan  por $_REQUEST y guardarlo en un .log
    
    
    $file = "json_log.txt";
    $fh = fopen($file, 'w') or die("can't open file");
    
    fwrite($fh, "Contenido de ".'$_REQUEST'.":\n\n");
    
    foreach ($_REQUEST as $key => $value)
    {
        $write = "$key = $value \n";
        fwrite($fh, $write);
    }  
    
    
    fclose($fh);
    
    
    
    
    
    // Paginacion (LIMIT)
    
        if ((isset($_REQUEST['limit'])) && (isset($_POST['start'])))  
        {  
            $limit = $_REQUEST['limit'];  
            $start = $_REQUEST['start'];  
            $limitClause = "LIMIT $start,$limit ";  
        }
        else
        {  
            $limitClause = "LIMIT 0,100 ";  
        }  
    
    // Ordenación remota (Al no estar presentes todos los registros en el  grid, (por la paginacion), necesitamos que cada peticion de ordenar del  grid sea gestionada por el lado servidor(ORDER BY))
    
        if ((isset($_REQUEST['sort'])) && (isset($_POST['dir']))) 
        {  
            $sort = $_REQUEST['sort'];  
            $dir = $_REQUEST['dir'];  
            $orderClause = "ORDER BY $sort $dir ";  
        }
        else
        {  
            $orderClause = "ORDER BY fecha_entrada DESC ";  
        }  
        
    // Crear WHERE a partir de $_REQUEST["fields"] y $_REQUEST["query"],  enviados por el plugin de busquedas del datagrid.
    
        if ((isset($_REQUEST['fields'])) &&  (isset($_POST['query']))) 
        {  
            $campos = $_REQUEST['fields'];  
            $criterios = $_REQUEST['query'];
            
            $campos = addslashes($campos);
            
            $prewhere = explode('\",\"', $campos);
            
            
            //escribir $prewhere en el log (debug).
            $fh1 = fopen("json_log.txt", 'a') or die("can't open file");
            
            fwrite($fh1, "\n\nContenido de ".'$prewhere'.":\n\n");
    
            for ($i=0;$i<=count($prewhere);$i++)
            {
                if($i==0)
                    $prewhere[$i]=substr($prewhere[0], 3);
                
                if($i==(count($prewhere)-1))
                    $prewhere[$i]=substr($prewhere[$i], 0,-3);
                
                $write1 = $prewhere[$i]."\n";
                fwrite($fh1, $write1);
            }  
            fclose($fh1);
            
            $where=implode(' LIKE '."'%$criterios%'".' OR '.'', $prewhere);
            
            $whereClause='WHERE '.$where.' LIKE '."'%$criterios%'".' ';
              
        }
        else
        {  
            $whereClause = "";  
        }  
    
        $count_query = "SELECT COUNT(*) FROM entrada as count";
        $result_count= mysql_query($count_query);
        
    
        while($fetch_count = mysql_fetch_array($result_count, MYSQL_NUM))
        {
            $count = $fetch_count[0];
        }
        
        
        $query="SELECT * FROM entrada  ".$whereClause.$orderClause.$limitClause;
        
        //Escribimos la consulta final en el log.
        $fh2 = fopen("json_log.txt", 'a') or die("can't open file");
            
        fwrite($fh2, "\n\n Consulta final: \n\n");
            
        $write2 = $query."\n\n".mysql_error();
        fwrite($fh2, $write2);
    
        fclose($fh2);
        
        
        // Performing SQL query
        $result = mysql_query($query) or die('Query failed: ' .  mysql_error());
        $all_recs = array();
        
        while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
            $all_recs[] = $line;
        }
        
     
    echo "{ 'results': $count, 'rows': ".json_encode($all_recs)."}";
    
            
     
    // Free resultset
    mysql_free_result($result);
     
    // Closing connection
    mysql_close($link);
    ?>

    Probably the problem are in my javascript code, because I know the query works...

    Other ploblem is: I only view the reset button, and not the search one, but pressing enter it reloads the store, without changes.

    Thanks.

  9. #799
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,561
    Vote Rating
    384
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    If fields and query are sent to the server correctly then it must be server-side problem.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  10. #800
    Ext User
    Join Date
    May 2010
    Posts
    3
    Vote Rating
    0
    Rbn_3d is on a distinguished road

      0  

    Default


    I'm testing it: now the php writes in a log the json response, and it´s ok (returns the results of the search ok), so:

    Can be a problem with JSON syntax (success or message property... etc)

    or

    Can be a problem in my javascript code (I think the ploblem are here)

    Here are my log when I try to search "Fax"


    Code:
    $_REQUEST content:
    
    sort = year 
    dir = ASC 
    fields = ["id","fecha_entrada","no_orden_entrada","year","procedencia","remitente","clase_doc","extracto","observaciones","url"] 
    query = Fax 
    
    
     Final query: 
    
    SELECT * FROM entrada WHERE id LIKE '%Fax%' OR fecha_entrada LIKE '%Fax%' OR no_orden_entrada LIKE '%Fax%' OR year LIKE '%Fax%' OR procedencia LIKE '%Fax%' OR remitente LIKE '%Fax%' OR clase_doc LIKE '%Fax%' OR extracto LIKE '%Fax%' OR observaciones LIKE '%Fax%' OR url LIKE '%Fax%' ORDER BY year ASC LIMIT 0,100 
    
    
    
     FINAL JSON: 
    
    ({'success': true, 'results': 2, 'rows': [{"id":"13","fecha_entrada":"2010-05-21","no_orden_entrada":"744","year":"0000","procedencia":"Andalucia","remitente":"Malaga","clase_doc":"Fax","extracto":"Pruebaaaa","observaciones":"Jaaaaaaaa","url":null},{"id":"14","fecha_entrada":"2010-05-21","no_orden_entrada":"45","year":"0000","procedencia":"etyh","remitente":"","clase_doc":"Fax","extracto":"djghjfgj","observaciones":"fgjfjhgcj","url":null}]})
    returns 2 rows, like in phpmyadmin using the same query, so it´s not a server side problem.

Thread Participants: 245

  1. franklt69 (5 Posts)
  2. galdaka (2 Posts)
  3. thameema (1 Post)
  4. Dumbledore (3 Posts)
  5. JeffBurr (1 Post)
  6. berend (1 Post)
  7. mystix (1 Post)
  8. salvi (1 Post)
  9. cobnet (1 Post)
  10. dawesi (2 Posts)
  11. mysticav (3 Posts)
  12. mike1993 (3 Posts)
  13. JorisA (1 Post)
  14. cricri (5 Posts)
  15. apaa (1 Post)
  16. mbstroz (5 Posts)
  17. notjoshing (1 Post)
  18. MeDavid (1 Post)
  19. AlxH (1 Post)
  20. pantarhei (5 Posts)
  21. DeeZ (3 Posts)
  22. NBRed5 (2 Posts)
  23. zoq (2 Posts)
  24. ajaxE (4 Posts)
  25. cmendez21 (1 Post)
  26. Ronaldo (1 Post)
  27. mjlecomte (25 Posts)
  28. smokeman (11 Posts)
  29. Nam (4 Posts)
  30. keithnlarsen (2 Posts)
  31. rednix (2 Posts)
  32. expertmo (4 Posts)
  33. cking (1 Post)
  34. jelt (4 Posts)
  35. bcamp1973 (2 Posts)
  36. grgur (2 Posts)
  37. dwt11 (1 Post)
  38. michiel (3 Posts)
  39. Shmoo (3 Posts)
  40. evilized (1 Post)
  41. fangstern (1 Post)
  42. vishalg (3 Posts)
  43. Strati (1 Post)
  44. ArtBuilders (6 Posts)
  45. dax (5 Posts)
  46. thatcoder (7 Posts)
  47. jcar98 (1 Post)
  48. derbbre (3 Posts)
  49. wm003 (1 Post)
  50. garraS (3 Posts)
  51. kenshin (1 Post)
  52. ByteLess (2 Posts)
  53. Lobos (1 Post)
  54. a4 (1 Post)
  55. durlabh (3 Posts)
  56. elDub (1 Post)
  57. rstuven (1 Post)
  58. crpatrick (4 Posts)
  59. zedisdead (1 Post)
  60. vector4711 (1 Post)
  61. oanimashaun (1 Post)
  62. donssmith (3 Posts)
  63. sanjshah (5 Posts)
  64. nielsendev (2 Posts)
  65. Jika (2 Posts)
  66. Cooldream (2 Posts)
  67. iTzAngel (1 Post)
  68. franck34 (2 Posts)
  69. paubach (2 Posts)
  70. stewart (1 Post)
  71. teknaut (4 Posts)
  72. pjesus (2 Posts)
  73. NotChris (5 Posts)
  74. juicymedia (2 Posts)
  75. v496820 (2 Posts)
  76. hazooma (1 Post)
  77. obbakilla (1 Post)
  78. BlueCamel (1 Post)
  79. feodor (1 Post)
  80. w3bbuilder (1 Post)
  81. johnsbrn (1 Post)
  82. razor (1 Post)
  83. seppy (3 Posts)
  84. stefanorg (3 Posts)
  85. jimkan (1 Post)
  86. kenja (2 Posts)
  87. sandy (1 Post)
  88. eri.TsingTao (1 Post)
  89. rainydays (1 Post)
  90. iLiketoGrid (1 Post)
  91. Shaguar (8 Posts)
  92. AMS949 (3 Posts)
  93. moegal (3 Posts)
  94. aleczapka (2 Posts)
  95. Stripeman (6 Posts)
  96. abhaysingh (5 Posts)
  97. mango (1 Post)
  98. NoahK17 (3 Posts)
  99. Remy (1 Post)
  100. medley (11 Posts)
  101. stevchen (1 Post)
  102. abraxxa (28 Posts)
  103. Efex (3 Posts)
  104. Rotomaul (2 Posts)
  105. miihiir (4 Posts)
  106. nebbian (1 Post)
  107. Riri (6 Posts)
  108. catalina (1 Post)
  109. Bing Qiao (1 Post)
  110. juferoto (2 Posts)
  111. bk1 (2 Posts)
  112. sami_user (1 Post)
  113. dmcclean (2 Posts)
  114. Pink.ME (3 Posts)
  115. sebrand (1 Post)
  116. charak (2 Posts)
  117. charleshimmer (16 Posts)
  118. patrosmania (4 Posts)
  119. rosecorp (1 Post)
  120. johrisd (1 Post)
  121. aomadevelopers (1 Post)
  122. nicola_java (1 Post)
  123. BitPoet (1 Post)
  124. OliverT (3 Posts)
  125. randomuser01 (2 Posts)
  126. schone (3 Posts)
  127. perdar (1 Post)
  128. ajain (3 Posts)
  129. getindas (1 Post)
  130. giega (1 Post)
  131. ryanyoungsma (1 Post)
  132. ph0enix (1 Post)
  133. italianboy (1 Post)
  134. LutzAlbers (3 Posts)
  135. Ajish (2 Posts)
  136. christophe67 (1 Post)
  137. jmariani (4 Posts)
  138. wki01 (4 Posts)
  139. wemerson.januario (1 Post)
  140. viciuascuns (4 Posts)
  141. JohnnyWheels (1 Post)
  142. nar (3 Posts)
  143. shab (2 Posts)
  144. mystik (1 Post)
  145. unnamed_dev (1 Post)
  146. ScottLoney (3 Posts)
  147. whodat (4 Posts)
  148. Alex84 (7 Posts)
  149. mjmonserrat (3 Posts)
  150. andy_ghg (2 Posts)
  151. knappy (1 Post)
  152. bareflix (2 Posts)
  153. makiavelli (1 Post)
  154. daniel_82 (1 Post)
  155. peteryjk (2 Posts)
  156. michael.pedrotti (1 Post)
  157. elona (3 Posts)
  158. chinnapandu (1 Post)
  159. jsundquist (6 Posts)
  160. feo (1 Post)
  161. dubito (2 Posts)
  162. Georgioa (1 Post)
  163. SchattenMann (4 Posts)
  164. Relleum (1 Post)
  165. ivan.kristianto (3 Posts)
  166. yeyepot (1 Post)
  167. raydeen (1 Post)
  168. easycodes (4 Posts)
  169. rockinrandall (5 Posts)
  170. redcs (3 Posts)
  171. hatsu1119 (1 Post)
  172. surendra_leo (1 Post)
  173. ssawchenko (11 Posts)
  174. Sigma (3 Posts)
  175. Lmouse (1 Post)
  176. Spongerusher (1 Post)
  177. ValiBOSS (1 Post)
  178. joe123 (3 Posts)
  179. scooter (3 Posts)
  180. harsha_velicheti (1 Post)
  181. ivanleblanc (9 Posts)
  182. m4v0 (3 Posts)
  183. jbusuulwa (1 Post)
  184. seedeg (6 Posts)
  185. Z24_2000 (3 Posts)
  186. markw (2 Posts)
  187. atutus (2 Posts)
  188. luke82 (3 Posts)
  189. rameshkt (2 Posts)
  190. elgalle (2 Posts)
  191. Vepe (2 Posts)
  192. barser (2 Posts)
  193. metra (5 Posts)
  194. hotdesc (4 Posts)
  195. chrislovecnm (1 Post)
  196. King_Aero (1 Post)
  197. idefix (5 Posts)
  198. daiei27 (3 Posts)
  199. LostSoul (2 Posts)
  200. tumbochka (3 Posts)
  201. Dipish (7 Posts)
  202. mcafee (1 Post)
  203. alexpotemkin (1 Post)
  204. ruperty (5 Posts)
  205. Rbn_3d (2 Posts)
  206. rxopt (1 Post)
  207. mayurid (1 Post)
  208. jeroen_syntux (2 Posts)
  209. aminaq (4 Posts)
  210. sosy (3 Posts)
  211. asafm (2 Posts)
  212. extjs1111_user (4 Posts)
  213. scottmartin (2 Posts)
  214. clements (1 Post)
  215. wavedan (3 Posts)
  216. jizhang88 (2 Posts)
  217. Coil (2 Posts)
  218. Samuel.reed (6 Posts)
  219. sense.nda12 (1 Post)
  220. zoja (1 Post)
  221. andyproxis (1 Post)
  222. baldeep_bhatia (1 Post)
  223. stevwinata (1 Post)
  224. Patrick86 (1 Post)
  225. dumpf (3 Posts)
  226. parimala (3 Posts)
  227. vicvolk (4 Posts)
  228. preichow (1 Post)
  229. shaoming (1 Post)
  230. Ixtinkt (7 Posts)
  231. jadiagaurang (1 Post)
  232. Juanyong (1 Post)
  233. venkateshns (1 Post)
  234. panpur (3 Posts)
  235. codeart.ch (2 Posts)
  236. hieu79vn (1 Post)
  237. mvsrekha (2 Posts)
  238. aislan (1 Post)
  239. buhari (1 Post)
  240. extjsquicklearner (1 Post)
  241. shankar8rajah1 (1 Post)
  242. jacinth_1215 (2 Posts)
  243. venkikodakirthi (1 Post)
  244. bwgv (1 Post)
  245. nckenn (1 Post)

Tags for this Thread