Results 1 to 6 of 6

Thread: Is it possible to add to an Ajax proxy store dynamically?

  1. #1
    Sencha User
    Join Date
    Jul 2017
    Posts
    64
    Answers
    6

    Default Answered: Is it possible to add to an Ajax proxy store dynamically?

    I have quite a few comboboxes where I'd like to insert an empty value into the first position of their stores. Some of them are using an Ajax proxy store.
    For the comboboxes that don't use a proxy store, I was able to insert an empty value by adding an 'afterrender' listener and putting a breakpoint on that in Chrome. From there I did the following:
    1.png

    If I do the same for the other comboboxes, when the breakpoint is hit, the data store is still empty. So instead, I added a 'load' listener onto the store declaration. When I try doing the same thing as above, I don't get any errors but nothing is actually added to the store:
    2.png

    Is this not something that can be done?

  2. Fiddle injecting a record after the store loads:


  3. #2
    Sencha Premium User
    Join Date
    Feb 2010
    Location
    Chicago
    Posts
    72
    Answers
    17

    Default

    Fiddle injecting a record after the store loads:


  4. #3
    Sencha User
    Join Date
    Jul 2017
    Posts
    64
    Answers
    6

    Default

    Quote Originally Posted by Johnny Major View Post
    Fiddle injecting a record after the store loads
    Thanks for the reply, one problem with that example though is that if the added item has its userId set to an empty string, it won't display anything in the combobox. One fix is to set the display field value to " ", then set the tpl for the combobox like here to hide that value when selected, although I was hoping to avoid that.

  5. #4
    Sencha Premium User
    Join Date
    Feb 2010
    Location
    Chicago
    Posts
    72
    Answers
    17

    Default

    If you want a blank entry just insert " " as the value:


  6. #5
    Sencha User
    Join Date
    Jul 2017
    Posts
    64
    Answers
    6

    Default

    But without adding the tpl, if you select the value it displays "nbsp;" in the combobox.

  7. #6
    Sencha Premium User
    Join Date
    Feb 2010
    Location
    Chicago
    Posts
    72
    Answers
    17

    Default

    Okay, your original question was asking how to add records dynamically to an ajax store. I have updated the fiddle with more information since your query has been modified. Adding a displayTpl...


Similar Threads

  1. Dynamically change a proxy url for a store
    By hirokenshin in forum Sencha Touch 2.x: Q&A
    Replies: 13
    Last Post: 6 Dec 2013, 7:14 PM
  2. Replies: 2
    Last Post: 17 Sep 2013, 11:11 AM
  3. change ajax proxy url dynamically
    By ayachesouhail in forum Sencha Touch 2.x: Discussion
    Replies: 1
    Last Post: 22 Jan 2013, 5:01 AM
  4. Replies: 1
    Last Post: 1 Sep 2012, 7:00 AM
  5. Replies: 2
    Last Post: 16 Aug 2012, 12:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •