I have a problem with ModelField

  1. #1

    I have a problem with ModelField

    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")
            )
        )
    }
    Attached Thumbnails Click image for larger version. 

Name:	modelField error.PNG 
Views:	92 
Size:	19.9 KB 
ID:	25422  
  2. #2
    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!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] here how to get value of modelfield in editor?
    By hdsoso in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 02, 2014, 7:23 AM
  2. [CLOSED] how to get modelfield from RowSelectionModel?
    By hdsoso in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 10, 2014, 6:08 AM
  3. How to get ModelField Value in ComboBox
    By coder in forum 2.x Help
    Replies: 1
    Last Post: Nov 24, 2013, 2:51 AM
  4. [CLOSED] Mapping on ModelField
    By ptrourke in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Apr 18, 2013, 12:45 AM
  5. [CLOSED] ModelField DateFormat problem
    By mirwais in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 01, 2013, 12:40 PM

Posting Permissions