PDA

View Full Version : autocomplete with extjs4: can not access to service



franco dumas
17 Aug 2013, 1:37 AM
I work with extjs 4, I want to do autocomplete with combobox
meaning when I entered a text in the combobox a request will send to database in order to display a list of emplyees ( in my case ) according to text entered in the combobox
in emplyeesModel.js I have




Ext.define('GenericComboModel', { extend: 'Ext.data.Model', fields: [ {name: 'label', type: 'string'}, {name: 'value', type: 'string'} ] }); var employeesStore= Ext.create('Ext.data.Store', { model: 'GenericComboModel', proxy: { type: 'ajax', url: 'employeesService', reader: { type: 'json', root: 'users' } } });

in emplyeesView.js I have





{ xtype: 'combobox', store: employeesStore, displayField: 'label', valueField: 'value', queryMode: 'remote', fieldLabel: 'test', editable: false, id: 'employees_IdCombo', hideTrigger:true queryParam: 'searchStr' }


in the service employeesService.java I have





public class employeesService{ public List<employees> getEmployeesListByLibelle(String libelle) { // TODO Auto-generated method stub Query query = getSession().createQuery("FROM employees emp where emp.libelle=:libelle "); query.setParameter("libelle", libelle); List result = query.list(); if(result.size()!=0 && result !=null) return result; else return null; } }


but when I run my example I have this errror :





GET http://localhost:8080/employeesService.getEmployeesListByLibelle?_dc=1376728740208&searchStr=testSearch&page=1&start=0&limit=25&filter=%5B%7B%22property%22%3A%22label%22%7D%5D 404 (Introuvable) ext-all-rtl.js:21

Gary Schlosberg
19 Aug 2013, 11:50 AM
Looks like you're not getting any data from your proxy (404 error). Is there a script at the 'employeesService' url that you used which delivers data?