1. #1
    Sencha User
    Join Date
    Feb 2009
    Posts
    38
    Vote Rating
    0
    soma13 is on a distinguished road

      0  

    Default auto complete ComboBox

    auto complete ComboBox


    Hi All,

    I would like to make an auto complete ComboBox in my sample web application. I have made a ComboBox with bean rpc proxy. The content of ComboBox fills up with an rpc call. It is working well. Here is my code:

    My bean code:
    Code:
    public class User implements BeanModelTag, Serializable {
       private String fullname;
       private int age;
    
       public String getFullname() {
          return fullname;
      }
    
       public void setFullname(String fullname) {
          this.fullname= fullname;
       }
       ...
    and my classes for rpc:
    Code:
    -- service -------------------------------------------
    public interface ExampleService extends RemoteService
    {
       public List<User> getUsers();
    }
    
    -- service async -------------------------------------------
    public interface ExampleServiceAsync
    {
       public void getUsers(AsyncCallback<List<User>> callback);
    }
    
    -- service impl -------------------------------------------
    public class ExampleServiceImpl extends RemoteServiceServlet implements ExampleService
    {
       public List<User> getUsers()
       {
          List<User> users = new ArrayList<User>();
          User user;
    
          user = new User();
          p.setFullname("Ext JS");
          p.setAge(13);
          users.add(user);
    
          user = new User ();
          user.setFullname("Ext GWT");
          user.setAge(31);
          users.add(user);
    
          return users;
       }
    }
    and my user interface class:
    Code:
    RpcProxy<User, List<User>> proxy = new RpcProxy<User, List<User>>()
    {
       @Override
       protected void load(User loadConfig, AsyncCallback<List<User>> callback)
       {
          service.getUsers(loadConfig, callback);
        }
    };
    
    PagingLoader loader = new BasePagingLoader(proxy, new BeanModelReader()
    {
       @Override
       protected ListLoadResult newLoadResult(Object loadConfig, List models)
       {
          PagingLoadResult result = new BasePagingLoadResult(models);
          return result;
       }
    });
    
    ListStore<BeanModel> store = new ListStore<BeanModel>(loader);
    loader.load();
    
    ComboBox<BeanModel> combo = new ComboBox<BeanModel>();
    combo.setMinChars(3);
    combo.setDisplayField("fullname");
    combo.setItemSelector("div.search-item");
    combo.setTemplate( getTemplate() );
    combo.setStore(store);
    combo.setHideTrigger(true);
    
    add(combo);
    In this case my getUsers() method returns with a big user list which contains data of the all users. After that I tried to modify this code because I want to use a filter string on server side when I collect the list of users.
    If user types "app" then getUsers() method has to return list of users which begin with "app". For example "apple", "appear" , "application", ....

    I modified my rpc classes:
    Code:
    -- service -------------------------------------------
    public interface ExampleService extends RemoteService
    {
       public List<User> getUsers(User user);
    }
    
    -- service async -------------------------------------------
    public interface ExampleServiceAsync
    {
       public void getUsers(User user, AsyncCallback<List<User>> callback);
    }
    
    -- service impl -------------------------------------------
    public class ExampleServiceImpl extends RemoteServiceServlet implements ExampleService
    {
       public List<User> getUsers(User user)
       {
          ...
       }
    }
    When I try to execute this code I get an error message:

    [ERROR] Unable to load module entry point class a.b.client.MainEntryPoint (see associated exception for details)
    java.lang.ClassCastException: com.extjs.gxt.ui.client.data.BasePagingLoadConfig cannot be cast to a.b.model.User


    I have some question about it. Could you help me?

    1. I do not understand what is wrong in my code. I ask you help to correct my code.
    2. I do not understand what happens when user is typing in combo box. How does the fullname variable receive a value when user is typing?


    regards, SoMa
    SoMa

  2. #2
    Sencha User
    Join Date
    Feb 2009
    Posts
    38
    Vote Rating
    0
    soma13 is on a distinguished road

      0  

    Question auto complete ComboBox or SuggestBox

    auto complete ComboBox or SuggestBox


    My first request is very important for me because I have a web application and it is not working without auto complete combo box (or SuggestBox).

    Could you help me?

    regards, SoMa
    SoMa

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    2
    tryanDLS is on a distinguished road

      0  

    Default


    Please don't post the same question in multiple places - your other thread has been deleted.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar