Active
Project:
The JIT
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
16 Apr 2012 at 10:56 UTC
Updated:
17 Apr 2012 at 07:32 UTC
Jump to comment: Most recent file
When the root item in a Space Tree uses an integer for ID (such as node ID), something goes wrong when JIT tries to determine the ID for displaying tree node info. This leads to an empty info box. (See example at http://skillcompass.org/.)
Make sure the ID is casted as a string.
Find a proper place in the JIT to cast the ID as a string.
Cast the ID as a string.
Test.
Commit, either to the JIT module or to the JIT library, whatever is more appropriate.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 1535334-9-assure_string_id_for_root.patch | 1.75 KB | clemens.tolboom |
| #8 | 1535334-8-assure_string_id_for_root.patch | 635 bytes | itangalo |
Comments
Comment #1
clemens.tolboomIs there no callback added to the Root node or not 'discovered' by the jit?
Can you provide for a data snippet if possible :)
Comment #2
itangalo commentedSorry – I was going to add some more comments, but got distracted. :-)
Below is the code I tested this with. It outputs the $id_string when any non-root item is clicked, but nothing is outputted when the root item is clicked. So it seems the function isn't called at all.
And here's the menu hook, in case it could be a source of problem.
Comment #3
clemens.tolboomYou could have said install sc for the code :p
But what I'm curious about is what the rendered tree has for the callback in javascript.
From http://skillcompass.org/ just below
So there is an ID for 'Drupal' ... which is 1. So I'm puzzled.
Maybe you could try the graphAPI modules view to fit into your callback scheme: admin/modules/graph that gives us better tests.
Comment #4
clemens.tolboomFWIW
On the demo site taken from the project page and fixed now #1534958: Demonstration link broken + another to see the module in action. http://aci-dev.tacc.utexas.edu/mrhanlon/thejit/jit/spacetree/debug
Clicking on the root works. (Make sure to check the show info node)
Comment #5
itangalo commentedI've been staring at various output and JS, trying to understand something.
My best guess right now is that the info callback fails when the ID is an integer rather than a string. When using node ID as identifier in JIT, the root item (and only the root item) gets an integer ID. All the others have IDs like "1__2".
When the root item is NOT a Drupal node, the ID becomes "_root", and things work.
Maybe it is some JS function that assumes that the ID is a string, and the callback is aborted when an error is thrown. Could be.
I don't know a line of JS, but found this that looks like a candidate:
id = node['id'].replace(that.thisid + '_','');(used at some place for fetching ID for a tree node)In the demo, linked above, the root item has ID "jitnode_1", so that fits the pattern as well.
Comment #6
itangalo commentedOk, I got some more support for the hypothesis in #5. I tried changing the to/from IDs from node ID to node titles, and now the info box renders just fine.
Something goes wrong when the tree item ID is an integer.
Updating the title and the issue summary.
Comment #7
clemens.tolboomIC
So this code could be the problem:
Comment #8
itangalo commentedAwesome!
This patch solves the problem.
Comment #9
clemens.tolboomI checked forcedirected ... patch only affects graph API data ... so needs works.
Attached patch will be committed shortly.
Comment #10
clemens.tolboom(commit has: 7300825..8cc16c7)
We need to make sure this will always happen. For whatever engine added in the future. As there are many.
So we need a thejit_validId() construct.
@see http://drupal.org/project/data_visualization having a Vizstruct defined. Does that overlap with thejit data tree?
Comment #10.0
clemens.tolboomUpdated summary with info about root item having integer (not string) ID casuses an error.