PDA

View Full Version : [CLOSED] [2.0] DataView with Razor Data



Timothy
Jul 09, 2012, 2:52 AM
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

Timothy
Jul 09, 2012, 2:54 AM
Latest 2.0 build from SVN.

Cheers,
Timothy

Daniil
Jul 09, 2012, 10:34 AM
Hi,

I think it should work. Maybe a bug. Could you provide a full sample to reproduce?

Timothy
Jul 09, 2012, 8:11 PM
I was able to solve this; it was because I was binding the data directly to the view and not the store.

Cheers

Daniil
Jul 09, 2012, 8:31 PM
Oh, yes, missed that.