Jan 19, 2019, 8:14 AM
Add MultiSelector value to Model
Hello FabrÃ*cio
I apologize for the length of the Thread before anything.but it is Last question.
As usual Mvc Grab the fields in View.for simple components like TextField and combo i used from "Value" atribute or ControlFor like What is mentioned below.
I examined following codes but the model was not filled
if i can attach value of Multiselector(array or list of Id's) to Model my problem is Solved.
Thank you very much for help
I apologize for the length of the Thread before anything.but it is Last question.
As usual Mvc Grab the fields in View.for simple components like TextField and combo i used from "Value" atribute or ControlFor like What is mentioned below.
X.TextField().ID("NumOfStudent").FieldLabel("students").Value(Model.NumOfStudent).Cls("SetFont")
or X.ComboBox().RTL(true)
.ID("ComboBoxPerson")
.TypeAhead(true)
.QueryMode(DataLoadMode.Local)
.ForceSelection(true)
.TriggerAction(TriggerAction.All)
.DisplayField("Text")
.ValueField("Value")
.Cls("combo-rtl")
.BaseCls("combo-rtl")
.EmptyValue(0)
.ControlFor("Title")
.Items((IEnumerable<Ext.Net.ListItem>)ViewBag.Data)
My last question is that how Can i add multiselector Value to ModelI examined following codes but the model was not filled
Html.X().MultiSelector()
.Width(400)
.Height(120)
.FieldName("Title")
.MultiSelect(true)
.AutoScroll(true)
.ControlFor("Units")
.Scrollable(ScrollableOption.Both)
.AllowDeselect(true)
.Selectable(true)
.Store(
Html.X().Store().ID("UnitStore")
.DataSource(Model.PartUnits)
.Model(
Html.X().Model()
.Fields(
new ModelField("Title", ModelFieldType.String),
new ModelField("Id", ModelFieldType.Int)
)
)
)
.Search((searchcomp) =>
{
searchcomp.Add(
Html.X().MultiSelectorSearch()
.SearchGridConfig(Html.X().GridPanel().BufferedRenderer(false))
.Store((store) =>
{
store.Add(
Html.X().Store()
.ID("UnitStores")
.DataSource(Model.Units)
.Model(
Html.X().Model()
.Fields(
new ModelField("Title", ModelFieldType.String)
)
)
);
})
);
})
and model public class EdPersonCreateVm : BaseEntityVm, IHaveCustomMappings
{
public IEnumerable<EdUnit> Units { get; set; } = null;
public IEnumerable<EdUnit> PartUnits { get; set; } = null;
public List<SelectListItem> roleList { get; set; }
public ICollection<EdClass> Classes { get; set; }
public IEnumerable<EdFeedBackBox> FeedBacks { get; set; }
public ICollection<EdLesson> Lessons { get; set; }
public IEnumerable<object> Unt { get; set; } = null;
.
.
.
}
It also did not work .ControlFor("Unt")
i need list of UnitId's that is displayed in the multiselector but this component has not ValueField for Setting" UnitId".I need this for use in controller but viewPage does not Grab Value of Multiselector.if i can attach value of Multiselector(array or list of Id's) to Model my problem is Solved.
Thank you very much for help
Last edited by orpheus; Jan 19, 2019 at 11:10 AM.