PDA

View Full Version : [CLOSED] Not able to refresh Ext.Net Combobox



PriceRightHTML5team
Sep 20, 2013, 6:50 AM
Hi Ext.Net Team,

Here's the scenario

I have two combobox one is study title and other is scenario they both gets loaded when the MVC view gets load for the first time. Both the combobox are binded using store's datasource. I have a select event on Study Title combox and on its change the scenario should change based on the study title.

Below is the code:


X.ComboBoxFor(x => x.ListStudyTitles[0].STUDY_TITLE_CD_STR).ID("CmbStudyTitle")
.DisplayField("STUDY_TITLE")
.ValueField("STUDY_TITLE_CD_STR")
.Store
(
X.Store().ID("StoreStudyTitle")
.Model(
X.Model()
.Fields(new ModelField("STUDY_TITLE"),
new ModelField("STUDY_TITLE_CD_STR"))
)
.DataSource(Model.ListStudyTitles)
)
.FieldLabel("Study Title").Listeners(ls => { ls.Select.Fn = "ChangeStudyTitleDrp"; })

//Scenario Combo
X.MultiCombo().ID("CmbScenario").FieldLabel(PR.Resources.RP.RP.RSCmbScenario).Lab elCls("fieldLabelTop")
.DisplayField("ScenarioName")
.ValueField("ScenarioUUID")
.CustomConfig(x =>
{
x.Add(new ConfigItem() { Name = "getDisplayValue", Value = "myGetDisplayValue", Mode = ParameterMode.Raw });
}
)
.Store
(
X.Store().ID("StorePrCountry")
.Model(X.Model()
.Fields(
new ModelField("ScenarioName"),
new ModelField("ScenarioUUID")
)
)
.DataSource(Model.ListExecutedScenarios)
)
.Listeners(ls => { ls.BeforeRender.Fn = "SetScenarioText"; })
.Listeners(ls => { ls.Select.Fn = "SelectScenario"; })



Jquery Code (Study Tilte Drpdown select event)


var ChangeStudyTitleDrp = function ()
{
var studyTitleCd = App.CmbStudyTitle.getValue();
Ext.net.DirectMethod.request({
url: '@Url.Action("StudyTitleChange", "Results")',
params: {
studytitleCd: studyTitleCd
},
success: function (data) {
var model = data.m;
debugger;

var store = App.CmbScenario.getStore();
store.loadData(model);
//}
},
failure: function (result) {
Ext.Msg.alert('Error', 'Error Selecting Scenario.');
}
});
}

MVC Controller Code:


public ActionResult StudyTitleChange(int studytitleCd)
{
var model = svc.GetRecords();
return this.Direct(new { m = model });
}

The issue is in the javascript debugger i see the new scenario list based on the study title cd. But the Scenario combobox still shows the same records for previous study title cd.

Can you please direct me what am i doing wrong

Thanks

Daniil
Sep 20, 2013, 7:15 AM
Hi @PriceRightHTML5team,

Please try to set up

.QueryMode(DataLoadMode.Local)
for the MultiCombo.

Does it help?

PriceRightHTML5team
Sep 20, 2013, 7:40 AM
Hi @PriceRightHTML5team,

Please try to set up

.QueryMode(DataLoadMode.Local)
for the MultiCombo.

Does it help?

Awesome its working. Thanks