jquery-treetable icon indicating copy to clipboard operation
jquery-treetable copied to clipboard

Re-init with Force duplicates the expander in the table

Open TomWhitson opened this issue 7 years ago • 1 comments

I have a table using an expanderTemplate and when I call refresh as below, I end up with multiple expanders in the row,

//tree table refresh
$('#sheet1').treetable({
	expandable: true, 
	expanderTemplate:'<a href="#"><i class="material-icons">expand_more</i></a>',
	onNodeExpand:updateStriping,
	onNodeCollapse:updateStriping
}, true);

TomWhitson avatar Aug 06 '17 10:08 TomWhitson

I had this issue as well, in my case I'm wrapping my TreeTable in a DataTable (not my choice, just something I was stuck with). I have the TreeTable set to force initialization when the DataTable Ajax load completes. The blind addition of the indicator was adding multiple each reload.

I resolved it by adding:

$('.indenter',this.treeCell).remove();

on line 34.

I figured it would be best to remove the old one, and have the regular addition occur since someone may want to change the indenter or expander during the reload (different data may require more). I guess technically the class could be changed from Indenter using the indenterTemplate, so it should probably be parse to get the class.

kenjdavidson avatar Apr 04 '18 14:04 kenjdavidson