Summary : there is a multilevel parent-child comment system.i.e.
Example :
comment 1
comment 1-1
comment 1-1-1
comment 1-2
comment 1-2-1
comment 1-2-2
Here, comment 1 is parent and comment 1-1 & comment 1-2 both are child of comment 1 and so on..
Requirement :
we want to achieve the sorting of whole object based on property value.i.e. timestamp(latest comment or reply will come on the top).
JSON Object :
{
"CommentText": "",
"CommentCreateStamp": "2016-03-22",
"Comments": [{
"CommentText": "comment 1",
"CommentCreateStamp": "2016-03-09",
"Comments": [{
"CommentText": "comment 1-1",
"CommentCreateStamp": "2016-03-15",
"Comments": [{
"CommentText": "comment 1-1-1",
"CommentCreateStamp": "2016-03-21",
"Comments": null
}]
}]
}],
"Comments": [{
"CommentText": "comment 2",
"CommentCreateStamp": "2016-03-12",
"Comments": [{
"CommentText": "comment 2-1",
"CommentCreateStamp": "2016-03-10",
"Comments": [{
"CommentText": "comment 2-1-1",
"CommentCreateStamp": "2016-03-14",
"Comments": null
}]
}]
}]
}
I tried so far :
JSfiddle : https://jsfiddle.net/asceeevb/
I seen lot of questions on Stack Overflow but not working as per requirement.
CommentCreateStampproperty.the latest comments should come on the top and same with child hierarchy also. I updated the JSON object. please check now.