BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
[ts]
this.htmlAttr = { class: "bold" };
this.localData = [
{ id: 1, name: 'Discover Music', hasChild: true, isBold: this.htmlAttr, expanded: true },
{ id: 2, pid: 1, name: 'Hot Singles', isBold: this.htmlAttr, expanded: true },
{ id: 3, pid: 2, name: 'Rising Artists' },
{ id: 25, pid: 21, name: 'Mobile MVC' }];
this.mainMenuViewFields = { id: 'id', parentId: 'pid', text: 'name', hasChild: 'hasChild', dataSource: this.localData, expanded: 'expanded', htmlAttribute: 'isBold'};
|
onready (args) {
$("#contextMenu").ejMenu({
menuType: ej.MenuType.ContextMenu,
openOnClick: false,
contextMenuTarget: "#mainMenuView",
fields: { dataSource: this.treeViewContext, id: "id", text: "text", imageUrl: "imageUrl" },
beforeOpen: function (args) {
if ($(args.target).hasClass('e-text')) {
//identify the bold TreeView node
if ($(args.target).closest(".e-item").hasClass("bold")) {
this.hideItems(["#202", "#203", "#204"]);
}
else {
this.showItems(["#202", "#203", "#204"]);
}
}
else
args.cancel = true; // prevent to open the Context Menu other than the TreeView node
}
});
}
|
[ts]
this.localData = [
{ id: 1, name: 'Discover Music', hasChild: true, isBold: true, expanded: true },
{ id: 2, pid: 1, name: 'Hot Singles', isBold: true, expanded: true },
{ id: 3, pid: 2, name: 'Rising Artists' },
{ id: 4, pid: 2, name: 'Live Music', isBold: true },
];
for (var i = 0; i < this.localData.length; i++) {
if (this.localData[i].isBold) {
this.localData[i].htmlAttr = { class: "bold" };
}
else {
this.localData[i].htmlAttr = { class: "nonbold" };
}
}
this.mainMenuViewFields = { id: 'id', parentId: 'pid', text: 'name', hasChild: 'hasChild', dataSource: this.localData, expanded: 'expanded', htmlAttribute: 'htmlAttr'};
|
[html]
<ej-treeview id="mainMenuView" [fields]="mainMenuViewFields" [template]="treetemplate" (ready)="onready($event)"></ej-treeview>
[ts]
constructor() {
this.treetemplate = "#treeTemplate";
}
[index.html]
<script id="treeTemplate" type="text/x-jsrender">
{{if isBold}}
<div class="bold">{{>name}}</div>
{{else}}
<div class="unbold">{{>name}}</div>
{{/if}}
</script>
|
onready (args) {
$("#contextMenu").ejMenu({
menuType: ej.MenuType.ContextMenu,
openOnClick: false,
contextMenuTarget: "#mainMenuView",
fields: { dataSource: this.treeViewContext, id: "id", text: "text", imageUrl: "imageUrl" },
beforeOpen: function (args) {
if ($(args.target).hasClass('e-text') || $(args.target).closest(".e-text")) {
//identify the bold TreeView node
if ($(args.target).closest(".e-text").find("div").hasClass("bold")) {
this.hideItems(["#202", "#203", "#204"]);
}
else {
this.showItems(["#202", "#203", "#204"]);
}
}
else
args.cancel = true; // prevent to open the Context Menu other than the TreeView node
}
});
} |