[CLOSED] Model binding to store

  1. #1

    [CLOSED] Model binding to store

    Hi,

    I have the next test case:

    Model:

    public class Test
        {
            public One TEST_ONE { get; set; }
            public Two TEST_TWO { get; set; }
    
            public Test()
            {
                this.TEST_ONE = new One { ONE = "1" };
                this.TEST_TWO = new Two { TWO = "2" };
            }
        }
    
        public class One
        {
            public string ONE { get; set; }
        }
    
        public class Two
        {
            public string TWO { get; set; }
        }

    Controller:

    public ActionResult Test()
            {
                Models.Test model = new Models.Test();
                
                return View(model);
            }

    View:

    @model Models.Test
    
    @using Ext.Net;
    @using Ext.Net.MVC;
    @{
        Layout = null;
        var X = Html.X();
    }
    
    <!DOCTYPE html>
    <html>
    <head>
        <script type="text/javascript">
    
            Ext.onReady(function () {
                Ext.getCmp('viewport_layout').updateLayout();
            });
    
        </script>
    
    </head>
    <body>
    
        @(Html.X().ResourceManager().ShowWarningOnAjaxFailure(false))
    
        @using (Html.BeginForm())
        {
            var dataView = X.DataView()
            .ID("dvTEST")
            .Store(
                Html.X().StoreFor(Model).ID("stTEST")
            )
            .MultiSelect(true)
            .OverItemCls("x-item-over")
            .ItemSelector("div.thumb-wrap")
            .EmptyText("No data")
            .TrackOver(true)
            .Tpl(
                    Html.X().XTemplate().Html(@"TEMPLATE")
                );
    
            
            var textField = X.TextFieldFor(m => m.TEST_ONE.ONE);
            
            @(X.Viewport()
            .ID("viewport_layout")
                .Layout(LayoutType.Fit)
                    .Items(dataView)
            )
        }
    
    </body>
    </html>
    I can't get the model data binded into the DataView store. The TextFieldFor Works perfectly.

    What I'm doing wrong?

    Thanks!
    Last edited by fabricio.murta; Sep 17, 2016 at 12:35 AM.
  2. #2
    Hello!

    I see your example is missing several items from what we have in our StoreFor model. You should base your usage of StoreFor from this example: Model - StoreFor.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hi,

    we solved the problem in other way.

    Thank you anyway!
  4. #4
    Hello @dlanza!

    Glad you could solve your problem! We would really appreciate if you could share in general lines (or based in the sample above) which solution worked for you in this case! It could be very useful for other people with the same problem searching the forums!
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Hi,

    I'm afraid that's not posible since we change the idea behind that page and the example above no longer applies.
  6. #6
    Hello @dlanza!

    Thanks for the feedback!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] problem with DisplayFieldFor model binding
    By matrixwebtech in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 10, 2014, 2:32 PM
  2. Form binding to the model
    By errno in forum 2.x Help
    Replies: 7
    Last Post: May 24, 2013, 5:34 AM
  3. [CLOSED] binding checkbox selection model
    By CarpFisher in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jul 18, 2012, 7:52 AM
  4. [CLOSED] MVC, Binding model to Store
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 08, 2011, 3:19 PM
  5. binding checkbox selection model
    By VipulTyagi in forum 1.x Help
    Replies: 2
    Last Post: Apr 07, 2011, 11:36 AM

Tags for this Thread

Posting Permissions