<% GridCardsView.Grid()
.CssClass("scrlh cardsViewGrid") // scrollbar for grid header when needed
.Reorderable()
.Mod(o => o.PageInfo().PageSize().AutoMiniPager().ColumnsSelector().CustomRender("cardsview"))
.Columns(
new Column { Bind = "Id", Width = 75, Groupable = false, Resizable = false },
new Column { Bind = "Person" }.Mod(o => o.Nohide()),
new Column { Bind = "Dish.Name" },
new Column { Bind = "Location" },
new Column { Bind = "Date", Width = 120 }.Mod(o => o.Autohide()),
new Column { Bind = "Country.Name", ClientFormat = ".(CountryName)", Header = "Country" },
new Column { Bind = "Chef.FirstName,Chef.LastName", Prop = "ChefName", Header = "Chef" })
.Url(Page.Url().Action("GetItems", "LunchGrid"))
.Resizable()
.Height(450); %>
<awe:Ocon runat="server" ID="GridCardsView" />
<script>
function cardsview(o) {
var api = o.api;
// node content add wrap for padding
api.ncon = function(p) {
if (!p.lvl) return p.ren();
return '<div style="padding-left:' + p.lvl + 'em;" >' + p.ren() + '</div>';
};
// group header content
api.ghead = function(g) {
return api.ceb() + g.c;
};
api.renderItem = function (opt) {
let { attr, item, ceb, content, indent } = opt;
const columns = o.columns;
if (!content) {
content = '';
for (let col of columns) {
// is column hidden
if (api.isColHid(col)) continue;
const header = col.Header ? col.Header + ': ' : '';
content += `<div class="elabel">${header}</div>${aweUtils.gcvw(api, col, opt)}</br>`;
}
}
if (ceb) {
attr.class += ' cardhead';
attr.style = `margin-left:${indent}em;`;
} else {
attr.class += ' itcard';
}
return `<div ${awef.objToAttrStr(attr)}>${content}</div>`;
};
// ignore columns width for grid content
o.syncon = 0;
// no alt rows
o.alt = 0;
}
</script>