Is it possible to initialize components using only html. I rather dont mix js code in my html, so I'm adding the data-ej attributes to my elements in html and read those in my external js file. So for example a grid:
HTML:
<div id="Grid"
data-url="Users/Data"
data-ej-enablerowhover="false"
data-ej-columns='[{"field":"Email"},{"field":"PhoneNumber"},{"field":"UserName"},{"field":"","headerText":"","template":"#columnTemplate","width":300}]'
data-ej-toolbarsettings-showtoolbar="true"
data-ej-toolbarsettings-toolbaritems='["search"]' >
</div>
JavaScript:
var dm = ej.DataManager({ url: $("#Grid").data("url"), adaptor: new ej.UrlAdaptor() });
$("#Grid").ejGrid({
dataSource: dm,
columns: $("#Grid").data("ej-columns"),
toolbarSettings: {
showToolbar: $("#Grid").data("ej-toolbarsettings-showtoolbar"),
toolbarItems: $("#Grid").data("ej-toolbarsettings-toolbaritems"),
customToolbarItems: $("#Grid").data("ej-toolbarsettings-customtoolbaritems")
},
enableRowHover: $("#Grid").data("ej-enablerowhover")
});
But this seems something that could work out of the box.