Hi,
I tried with the way you suggested.
There seems some problem with the below line of code: -
.Listeners(l=>l.Bind.Handler = "cmp.store.add(record.MasteryNames().getRange());" )
Also, I am not very clear what exactly is written or should be written inside the string which is assigned to the handler above.
- what is 'cmp.store.add'? do i need to write the same or something else in my context?
- 'record.MasteryNames().getRange()' give error as 'MasteryNames' is not an identified method. If I remove the brackets, it gives error as 'MasteryNames' is undefined.
Below is my code sample for reference: -
Let me know what correction is required here.
Model: -
CompetencyMasteryDTO
[DataContract]
public class CompetencyMasteryDTO
{
[DataMember]
public int Position_Grade_Id { get; set; }
[DataMember]
public int Competency_Mastery_Id { get; set; }
[DataMember]
public int Competency_Id { get; set; }
[DataMember]
public int Mastery_Id { get; set; }
[DataMember]
public string Competency_Name { get; set; }
[DataMember]
public string Mastery_Name { get; set; }
[DataMember]
public int Is_Active { get; set; }
[DataMember]
public int Competency_Mastery_Assignment_Id { get; set; }
[DataMember]
public List<MasteryDTO> List_Mastery { get; set; }
[DataMember]
public Int32 List_CompetencyId { get; set; }
}
MasteryDTO
[DataContract]
public class MasteryDTO
{
[DataMember]
public int Mastery_Id;
[DataMember]
public int Competency_Mastery_Id { get; set; }
[DataMember]
public int Competency_Id { get; set; }
[DataMember]
public string Mastery_Name;
[DataMember]
public string Mastery_Desc;
[DataMember]
public int Badge_Id;
[DataMember]
public int Is_Active;
}
View: -
<%: Html.X().GridPanel()
.Width(400)
.Height(500)
.ID("competenciesGridPanel")
.Store(Html.X().Store()
.ID("storeId")
.Model(Html.X().Model()
.Fields(
new ModelField("Competency_Mastery_Id", ModelFieldType.Int),
new ModelField("Competency_Name", ModelFieldType.String),
new ModelField("Mastery_Id", ModelFieldType.Int),
new ModelField("Competency_Id", ModelFieldType.Int))
.Associations(a =>{a.Add(new HasManyAssociation { Model = "MasteryDTO", Name = "MasteryNames", AssociationKey = "List_Mastery" });
})
)
.DataSource(Model))
.ColumnModel(
Html.X().Column().ID("cmptncyMasteryId").DataIndex("Competency_Mastery_Id").Hidden(true),
Html.X().Column().DataIndex("Competency_Id"),
Html.X().Column().DataIndex("Competency_Name"),
Html.X().ComponentColumn()
.Flex(1)
.DataIndex("Index")
.Editor(true)
.Component(Html.X().ComboBox()
.Flex(1)
.DisplayField("Mastery_Name")
.ValueField("Mastery_Id")
.QueryMode(DataLoadMode.Local)
.TriggerAction(TriggerAction.All)
.Store(Html.X().Store()
.AutoLoad(false)
.ModelName("MasteryDTO"))
)
.Listeners(l=>l.Bind.Handler = "cmp.store.add(record.MasteryNames.getRange());")
)
%>