Author Topic: 9.1.1 tree lines wrong  (Read 534 times)

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 126
    • View Profile
9.1.1 tree lines wrong
« on: December 21, 2023, 03:52:12 am »
Setting options->treeModel->hideLines to false, there are mistakes in the lines with larger trees.

See attached image.  The red dots in the image are missing lines, and the green circles are extra tails that should not be there.

Also the last item in the tree always has an open node triangle, even if it has no children.
« Last Edit: December 25, 2023, 06:52:16 am by paramvir »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6296
    • View Profile
Re: TREE BUG 9.1.1 tree lines wrong
« Reply #1 on: December 21, 2023, 11:32:01 am »
Could you please share a jsfiddle to help check the reported issue.
« Last Edit: December 21, 2023, 11:33:59 am by paramvir »

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 126
    • View Profile
Re: TREE BUG 9.1.1 tree lines wrong
« Reply #2 on: December 22, 2023, 06:21:39 pm »
« Last Edit: December 22, 2023, 07:07:31 pm by jplevene »

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 126
    • View Profile
Re: TREE BUG 9.1.1 tree lines wrong
« Reply #3 on: December 22, 2023, 10:35:45 pm »
Previous Fiddle went wrong.  Correct one:

https://jsfiddle.net/w4d8Lb23/12/

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6296
    • View Profile
Re: TREE BUG 9.1.1 tree lines wrong
« Reply #4 on: December 23, 2023, 09:54:30 pm »
Thanks for the jsfiddle.

tree lines don't appear correctly because of a small issue in your implementation.

treeModel.id is name of field which stores unique identifier of each row. You set it to "item_index" but it's doesn't hold unique values in the tree data rows.

"ID" field seems to be unique in the tree data so the treelines display correctly when treeModel.id is set to "ID". Corrected jsfiddle: https://jsfiddle.net/h4kutynp/
« Last Edit: December 23, 2023, 09:56:23 pm by paramvir »

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 126
    • View Profile
Re: TREE BUG 9.1.1 tree lines wrong
« Reply #5 on: December 23, 2023, 10:45:06 pm »
Thanks, I did see that but as the previous tree worked fine I didn't think it would be an issue.

There is still one more issue, in that the last item on the entire list (right down at the bottom), even though it is empty it gets an expand icon.

The "children" value is an empty array, when the field is removed it displays correctly. Is this the correct workflow?
« Last Edit: December 23, 2023, 10:50:11 pm by jplevene »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6296
    • View Profile
Re: 9.1.1 tree lines wrong
« Reply #6 on: December 25, 2023, 01:40:09 pm »
That's right,

node having empty children array is a parent node having no children nodes

and

node without children property is a child itself.

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 126
    • View Profile
Re: 9.1.1 tree lines wrong
« Reply #7 on: December 30, 2023, 02:42:40 am »
I have noticed one final issue with the tree lines, however I think it best to add an option to correct it due to a possible issue below:

If you look at the screenshot attached, some node/rows where the text wraps to the next line goes through the tree lines (this is from a mobile phone). 

The obvious fix is to indent the text, however if the indent is quite large from having lots of ancestors, you might only get space enough for a partial word (or just a letter) on each wrapped line.  The reason for optional is to overcome this and backwards compatibility.

A better option apart from a true or false would be an option to only indent line wraps if the gap is more than a certain width (it would default to null or something like that meaning never indent line wraps).  So if there is a level set at 75px and the gap is 100px, it would wrap text with the appropriate indent.  However if the gap is 50px (lower than 75px setting), it would wrap with no indent like it does at the moment. My point is that sometimes indenting the wrapped text might cause more issues due to limited space, thus it needs to be a conditional option.