I have a db table with users and I am creating a hierarchy system.
Currently the top users (with a 1 hierarchy) are shown, and then when clicked I gather all the related users via ajax and display below.
These users have 4 or 5 tiers for their hierarchy. 1 being the highest level.
I want to be able to make a new line of users each time the hierarchy changes.
I query the db and fetch all the users with an order by of the hierarchy number, I then put them into an array, return with JSON and loop through in jQuery:
for(var i=0; i<data.userArray.length; i++){
var user = data.userArray[i];
$appendedItems.append(SHOW ALL USERS HERE);
}
Lets say the array is:
hierarchy => 2,
hierarchy => 2,
hierarchy => 2,
hierarchy => 3,
hierarchy => 3,
hierarchy => 4,
Each time the hierarchy changes, I would like to show a line break or something just to put the users on a new line to denote a lower level.
Thanks.