How do I apply the following CSS to only the Parent nodes of a Kendo Tree View? -
i have css class:
.relationshipstree { display: inline; font-size: 10pt; text-decoration: none; /*cursor: hand;*/ overflow: hidden; overflow-x: hidden; overflow-y: hidden; filter: none; font-weight: bold; color: green; background-color: transparent; }
and want use on parent nodes of kendo tree view:
<div id="relationshipstree"></div>
how go doing this?
edit -
this .js file i'm using create tree. added:
$('#relationshipstree').parent().addclass('relationshipstree');
based on answer here, however, still not working.
whole file:
function createrelationshipstree() { var primarycontactid = 671; var personorcompany = 'c'; var rootmemberid = 0; var data = new kendo.data.hierarchicaldatasource({ transport: { read: { url: "../api/relationships?primarycontactid=" + primarycontactid + "&personorcompany=" + personorcompany + "&rootmemberid=" + rootmemberid, contenttype: "application/json" } }, schema: { model: { haschildren: "haschildren", children: "items" } } }); $("#relationshipstree").kendotreeview({ datasource: data, loadondemand: true, dataurlfield: "linksto", datatextfield: ["name", "name"], select: treeviewselect }); function treeviewselect(e) { var node = this.dataitem(e.node); window.open(node.notificationlink, "_self"); } $('#relationshipstree').parent().addclass('relationshipstree'); } function refreshprojecttree() { var treeview = $("#relationshipstree").data("kendotreeview"); treeview.datasource.read(); }
updated
i found have misunderstood question. think want select dom parent element while want select parent node in tree view. updated answer.
midify handler bit:
function treeviewselect(e) { $('#relationshipstree div').removeclass('relationshipstree'); $(e.node).parents('li').first().children('div').addclass('relationshipstree'); var node = this.dataitem(e.node); window.open(node.notificationlink, "_self"); }
a demo updated here
Comments
Post a Comment