reset selected index value in ajax linked combo in update Mode (Serverside)

  1. #1

    reset selected index value in ajax linked combo in update Mode (Serverside)

    Hi
    i am using linked combos for Country ,state and City like Sample code shown below. There is no problem loading the page but when we need fill combo with the previous values in update mode only country's Combo is working properly and state,s combo and city's combo do not have the correct selected index value(The first item in the list is selected) Of course the list of cities and provinces is correct.

    for example we select Brazil for country and Goias for state and Cacu for city but in update mode when i use SetValueAndFireSelect combo fill with Brazil for country Acre for state and Abadiania for city.
    acre is first in list of states of brazil and Abadiania is first of city of Goias .list is correct but selected index is not

    
                                 Html.X().ComboBox()
                                          .ID("ComboBoxCountry")
                                          .TypeAhead(true)
                                          .QueryMode(DataLoadMode.Local)
                                          .TriggerAction(TriggerAction.All)
                                          .DisplayField("name")
                                          .ValueField("code")
                                          .EmptyText("select a Country")
                                          .Listeners(ls =>
                                              ls.Select.Handler = "App.ComboBoxState.clearValue(); App.ComboBoxState.getStore().load()"
                                          )
                                          .Store(Html.X().Store()
                                              .Model(Html.X().Model()
                                                  .IDProperty("Id")
                                                  .Fields(
                                                      new ModelField("id", ModelFieldType.String) { Mapping = "Id" },
                                                      new ModelField("name", ModelFieldType.String) { Mapping = "Name" }
                                                      , new ModelField("code", ModelFieldType.String) { Mapping = "code" }
                                                  )
                                              )
                                              .Proxy(Html.X().AjaxProxy()
                                                  .Url(Url.Action("GetCountry"))
                                                  .Reader(Html.X().JsonReader().RootProperty("data"))
                                              )
                                          ),
                                      Html.X().ComboBox()
                                          .ID("ComboBoxState")
                                          .TypeAhead(true)
                                          .QueryMode(DataLoadMode.Local)
                                          .TriggerAction(TriggerAction.All)
                                          .DisplayField("name")
                                          .ValueField("code")
                                          .Listeners(ls =>
                                              ls.Select.Handler = "App.ComboBoxCities.clearValue(); App.ComboBoxCities.getStore().load()"
                                          )
                                     
                                          .Store(Html.X().Store()
                                              .AutoLoad(false)
                                              .Model(Html.X().Model()
                                                  .IDProperty("Id")
                                                  .Fields(
                                                      new ModelField("id", ModelFieldType.String) { Mapping = "Id" },
                                                      new ModelField("name", ModelFieldType.String) { Mapping = "Name" }
                                                      , new ModelField("code", ModelFieldType.String) { Mapping = "code" }
                                                  )
                                              )
                                              .Proxy(Html.X().AjaxProxy()
                                                  .Url(Url.Action("Getstate"))
                                                  .Reader(Html.X().JsonReader().RootProperty("data"))
                                              )
                                              .Parameters(ps =>
                                                  ps.Add(new StoreParameter("country", "App.ComboBoxCountry.getValue()",ParameterMode.Raw)) 
                                              )
                                              .Listeners(ls =>
                                                  ls.Load.Handler = @"var combo = 
                                                App.ComboBoxState;combo.setValue(records[0].get(combo.valueField));"
                                              )
                                          )
                                      ,
                                      Html.X().ComboBox()
                                          .ID("ComboBoxCities")
                                          .TypeAhead(true)
                                          .Scrollable(ScrollableOption.Vertical)
                                          .QueryMode(DataLoadMode.Local)
                                          .TriggerAction(TriggerAction.All)
                                          .DisplayField("name")
                                          .ValueField("id")
                                          .Store(Html.X().Store()
                                              .AutoLoad(false)
                                              .Model(Html.X().Model()
                                                  .IDProperty("Id")
                                                  .Fields(
                                                      new ModelField("id", ModelFieldType.String) { Mapping = "Id" },
                                                      new ModelField("name", ModelFieldType.String) { Mapping = "Name" }
                                                      , new ModelField("code", ModelFieldType.String) { Mapping = "code" }
                                                  )
                                              )
                                              .Proxy(Html.X().AjaxProxy()
                                                  .Url(Url.Action("GetCity"))
                                                  .Reader(Html.X().JsonReader().RootProperty("data"))
                                              )
                                              .Parameters(ps =>
                                                  ps.Add(new StoreParameter("State", "App.ComboBoxState.getValue()", ParameterMode.Raw))
                                              )
                                              .Listeners(ls =>
                                                  ls.Load.Handler = @"var combo = App.ComboBoxCities;
                        combo.setValue(records[0].get(combo.valueField));"
                                              )
                                          )
    and in server side:
    
     this.GetCmp<ComboBox>("ComboBoxCountry").SetValueAndFireSelect(ad.Country);
     this.GetCmp<ComboBox>("ComboBoxState").SetValueAndFireSelect(ad.State);
     this.GetCmp<ComboBox>("ComboBoxCities").SetValueAndFireSelect(ad.City);
    Thank you for telling me which part of my code is wrong
  2. #2

    i drop this product

    I asked a few questions in this forum several times but got no answer so I had to remove this product of my project because it doesn't have good support

Similar Threads

  1. Replies: 3
    Last Post: Jun 03, 2011, 1:10 PM
  2. Example Ajax Linked Combo don't worked
    By vooka in forum 1.x Help
    Replies: 3
    Last Post: Jul 11, 2010, 8:00 PM
  3. Ajax linked combo box in Grid control
    By vs.mukesh in forum 1.x Help
    Replies: 0
    Last Post: Jul 01, 2010, 11:06 AM
  4. [CLOSED] TextField Reset Text from ServerSide Not Working
    By webclouder in forum 1.x Premium Help
    Replies: 9
    Last Post: May 11, 2010, 2:25 PM
  5. Replies: 6
    Last Post: Jul 31, 2009, 2:45 PM

Posting Permissions