[CLOSED] [2.0] DataView with Razor Data

  1. #1

    [CLOSED] [2.0] DataView with Razor Data

    Hello,

    When using the following example below, I'm unable to select (click) on objects, even though I have my CSS rules defined:

            Html.X().Panel()
                .BodyPadding(15)
                .Border(false)
                .Layout(LayoutType.Fit)
                .Items(a =>
                {
                    a.Add(Html.X().DataView()
                        .ItemSelector("div.icon")
                        .OverItemCls("icon-hover")
                        .SelectedItemCls("icon-selected")
                        .TrackOver(true)
                        .Control(control =>
                            control.Data = Model.GetValues()
                                .Select(m => new
                                {
                                    Id = m.Id,
                                    DisplayName = m.DisplayName
                                } )
                                .ToList()
                        )
                        .Store(store =>
                            store.Add(Html.X().Store()
                                .Model(model =>
                                    model.Add(Html.X().Model()
                                        .IDProperty("Id")
                                        .Fields(fields =>
                                        {
                                            fields.Add(Html.X().ModelField()
                                                .Name("Id")
                                            );
    
    
                                            fields.Add(Html.X().ModelField()
                                                .Name("DisplayName")
                                                .Type(ModelFieldType.String)
                                            );
                                        } )
                                    )
                                )
                            )
                        )
                        .Tpl(Html.X().XTemplate()
                            .Html(@"
    <tpl for=""."">
        <div class=""icon module"">
            <div class=""icon-title"">{DisplayName}</div>
            <div class=""icon-description"">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In pellentesque interdum dolor quis iaculis. Ut non lorem tellus. Etiam augue erat, tincidunt ut convallis blandit, ornare aliquam urna. Vestibulum vulputate quam ultrices urna cursus consectetur. Integer at libero orci. Etiam fringilla porttitor metus ut vestibulum.</div>
        </div>
    </tpl>
                            ")
                        )
                    );
                } )
            )
    Works everywhere else in my code, where I am using a proxy to load the data instead.

    Any suggestions? Or have you run into anything similar?

    Cheers,
    Timothy
    Last edited by Daniil; Jul 09, 2012 at 7:32 PM. Reason: [CLOSED]
  2. #2
    Latest 2.0 build from SVN.

    Cheers,
    Timothy
  3. #3
    Hi,

    I think it should work. Maybe a bug. Could you provide a full sample to reproduce?
  4. #4
    I was able to solve this; it was because I was binding the data directly to the view and not the store.

    Cheers
  5. #5
    Oh, yes, missed that.

Similar Threads

  1. [MVC + Razor] How to load data on the form?
    By Natalie in forum 2.x Help
    Replies: 4
    Last Post: Sep 18, 2012, 10:24 AM
  2. Replies: 1
    Last Post: Jul 02, 2012, 6:19 PM
  3. [CLOSED] DataView template JS error when bound with data
    By cleve in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 07, 2012, 1:51 PM
  4. [CLOSED] DataView to DataView Drag and Drop
    By paulc in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 10, 2012, 8:19 PM
  5. [CLOSED] Try to use DataView, XTemplate has no data...
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 22, 2010, 6:40 PM

Posting Permissions