1. #1
    Sencha User
    Join Date
    Jun 2013
    Posts
    5
    Vote Rating
    0
    aram.dermenjian is on a distinguished road

      0  

    Default Answered: Bind Store without Losing Value

    Answered: Bind Store without Losing Value


    I have a combobox and I'm setting the value through:

    combobox.setValue(x);

    After I set the value I am changing the store of the combobox in such a way that value x no longer exists in the new store. After I do the bind the value of the combobox disappears (I assume because the new store doesn't contain that record). Is there anyway to have the value NOT disappear on changing the store? I want the value to remain even after changing the store.

    Thanks

  2. It depends a bit on what is allowed to get submitted. In case you are using forceSelection: true, it does not really make sense to just set an invalid value.

    In that case, before you unbind the old store, get the selected record and add / insert it to the new store. Then you can use setValue() on the combo again and have a valid value.

    If you allow to submit anything, save the value before unbinding the old store, bind the new one and use setRawValue() on the combo.

    Best regards
    Tobias

  3. #2
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,669
    Answers
    130
    Vote Rating
    110
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    It depends a bit on what is allowed to get submitted. In case you are using forceSelection: true, it does not really make sense to just set an invalid value.

    In that case, before you unbind the old store, get the selected record and add / insert it to the new store. Then you can use setValue() on the combo again and have a valid value.

    If you allow to submit anything, save the value before unbinding the old store, bind the new one and use setRawValue() on the combo.

    Best regards
    Tobias
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

  4. #3
    Sencha User
    Join Date
    Jun 2013
    Posts
    5
    Vote Rating
    0
    aram.dermenjian is on a distinguished road

      0  

    Default


    I hadn't set 'forceSelection' to true, but the setRawValue concept ended up working. By doing setRawValue though I've now a different problem.

    I want to make sure that the value and the display value are different (one is numeric while the other is a string). When doing rawValue it changes the val of both the value and rawValue. Is there someway to set the value to one thing and the rawValue to another without overriding each other?

  5. #4
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,669
    Answers
    130
    Vote Rating
    110
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    as mentioned before: the better way is to copy the selected record to the new store. this way you have the display and value field and you can use setValue().
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

  6. #5
    Sencha User
    Join Date
    Jun 2013
    Posts
    5
    Vote Rating
    0
    aram.dermenjian is on a distinguished road

      0  

    Default


    The issue is that they are both using the same table in the DB. If I were to do an 'insert' into the new store it would create a duplicate row in the DB which would not be ideal.

    I need 2 stores as each store has a different filter associated with it since I can't just filter a store as filtering a store will automatically update all comboboxes so I need different stores for different filters.

    Unless there is a way to insert into a store that has autoSync set to true while forcing it to not sync temporarily (or at all) as I need autoSync to normally be associated. (Basically autoSync needs to be able to continuously pull but to never push data)

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi