maxazan/jquery-treegrid

Added expand to title of treenode as well as chevron

Opened this issue · 0 comments

This altered version of the initExpander code will add the expand action to the title of each treenode:
( makes it much easier to use, don't know how to add this to code, sorry )
initExpander: function() {
var $this = $(this);
var cell = $this.find('td').get($this.treegrid('getSetting', 'treeColumn'));
var tpl = $this.treegrid('getSetting', 'expanderTemplate');
var expander = $this.treegrid('getSetting', 'getExpander').apply(this);
if (expander) {
expander.remove();
}
$(tpl).prependTo(cell).click(function() {
$($(this).closest('tr')).treegrid('toggle');
});
// %%%%%%%%%% added these lines %%%%%%%%%%%%%%%
$(cell).find(".title").click(function () {
$($(this).closest('tr')).treegrid('toggle');
});
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
return $this;
},