[CLOSED] How to use data from database in "Combo with Templates and Ajax" example

  1. #1

    [CLOSED] How to use data from database in "Combo with Templates and Ajax" example

    Hi,

    I am needing to use the component having the "autofill" functionality in this example: http://examples2.ext.net/#/Form/ComboBox/Custom_Search/

    How can I do this filling the store of combobox with an database and using the text that user are writting in my query?

    I really need to use an handler like in example or can I use a method in server-side code of the page, that be called every time that user write one letter?

    I appreciate your attention.
    Last edited by Baidaly; Jan 17, 2013 at 6:16 PM. Reason: [CLOSED]
  2. #2
    Hello!

    You can use DirectMethod to send data from DB to Client. Everything should be the same you just have to replace store's Proxy. Example: http://examples2.ext.net/#/GridPanel..._DirectMethod/
  3. #3
  4. #4
    Hello @avante,

    There are two problems.

    1. Referencing a DirectMethod within a user control.

    By default, it is
    App.direct.UserControlID.DirectMethodName
    So, this is wrong:
    DirectFn="App.direct.BindData"
    You can set up
    [DirectMethod(IDAlias="UC")]
    public object BindData() { ... }
    and use
    DirectFn="App.direct.UC.BindData"
    See also:
    http://examples2.ext.net/#/Events/Di...thods/ID_Mode/

    We also investigate a possibility to get this working.
    DirectFn="#{DirectMethods}.BindData"
    2. Using a static DirectMethod within a user control.

    Unfortunately, it can be defined on the page level only. So, please remove "static".

    Here are some more details.
    http://forums.ext.net/showthread.php...ll=1#post51877
  5. #5
    Quote Originally Posted by Daniil View Post
    We also investigate a possibility to get this working.
    DirectFn="#{DirectMethods}.BindData"
    This should work after updating from SVN (trunk).
  6. #6
  7. #7
    Quote Originally Posted by avante View Post

    1) How can I filter the results that will appear in the combobox with the text that is written by the user, in the moment that he write?

    2) What I need to do for the paging works? At this moment, all results of my research are appearing without respecting paging.
    Please, take a look at this example http://examples2.ext.net/#/GridPanel.../DirectMethod/ . Requested query you can find in ExtraParams.

    [DirectMethod(IDAlias = "UC")]
    public object BindData(string action, Dictionary<string, object> extraParams)
    {
    	StoreRequestParameters prms = new StoreRequestParameters(extraParams);
    	string query = (string)extraParams["query"];
    	
    	return Data;
    }
  8. #8
  9. #9
    Setting these options for the Store appears to be helpful.
    AutoLoad="true" IsPagingStore="true" PageSize="2"
    Though it is a tricky scenario to load data on the Change event.

    If you need to load data remotely on typing and organize paging, configuring the Store with a Proxy is the best solution.
  10. #10
    Very good Daniil, it works now.

    You can close this thread.

    Thank you very much.

Similar Threads

  1. Replies: 5
    Last Post: Jul 19, 2012, 12:09 PM
  2. Replies: 1
    Last Post: Jun 26, 2012, 11:29 AM
  3. Replies: 4
    Last Post: May 22, 2012, 10:40 AM
  4. Replies: 5
    Last Post: May 02, 2012, 5:37 PM
  5. Replies: 4
    Last Post: Oct 11, 2011, 2:42 AM

Tags for this Thread

Posting Permissions