PDA

View Full Version : I have a problem with ModelField



HenrySseki
Sep 03, 2020, 5:26 PM
I am new to Ext.Net. I setup everything as the guide but I created a view, added a sample MVC code sample and I get an error of
'The type or namespace 'ModelField' could not be found(are you missing a using directive or an assembly reference?)'.



@using Ext.Net.HtmlHelpers
@using Ext.Net.Core

@section headtag{

}
@section home
{
<h1>Simple Array Grid</h1>

@(Html.X().GridPanel()
.Title("Cell commands")
.Width(700)
.Height(300)
.Store(Html.X().Store()
.Model(Html.X().Model()
.Fields(
new ModelField("company"),
new ModelField("price", ModelFieldType.Float),
new ModelField("change", ModelFieldType.Float),
new ModelField("pctChange", ModelFieldType.Float)
)
)
.DataSource(Model)
)
.ColumnModel(
Html.X().Column().Text("Company").DataIndex("company").Flex(1),
Html.X().Column().Text("Price").DataIndex("price"),
Html.X().Column().Text("Change").DataIndex("change").Renderer("change"),
Html.X().Column().Text("Change").DataIndex("pctChange").Renderer("pctChange"),
Html.X().DateColumn().Text("Last Updated").DataIndex("lastChange")
)
)
}

fabricio.murta
Sep 10, 2020, 4:19 AM
Hello @HenrySseki, and welcome to Ext.NET forums!

Ext.NET 7 is currently in a stage where syntax may change dramatically between versions (that's why we don't call it beta yet). So perhaps the guide you used (you didn't link which guide you're talking about) no longer matches the syntax for model fields. Your best bet is to just trust IntelliSense as it will point you what is accepted within the .Model().Fields() context.

You probably want something like this:



new DataField() { Name = "company" },
new NumberDataField() { Name = "price"),
new NumberDataField() { Name = "change"),
new NumberDataField() { Name = "pctChange")


Hope this helps!