Hello there.
I have been trying to create an organization chart very similar to the "Transfer Employee"-example, but ran into a little problem, cause I needed to change it from a grouped binding to a single binding.
I played around with the OnClientDropping-function, but can't really twist it to fit my perpose.
When I drag an element from the listview, to an element in the OrgChart, it should make the new element a child of the element dropped on, and the ajax-update i working like a charm, but the _getRealHierarchicalIndex seems to return 0 every time.
As you can see, I have only changed the rocGroup to a rocItem, and ofcause it gives me some problems in the RadAjaxManager2_AjaxRequest, cause the ids contains ether 0 or 0:0
Here's the start of the AjaxRequest:
I have been trying to create an organization chart very similar to the "Transfer Employee"-example, but ran into a little problem, cause I needed to change it from a grouped binding to a single binding.
I played around with the OnClientDropping-function, but can't really twist it to fit my perpose.
When I drag an element from the listview, to an element in the OrgChart, it should make the new element a child of the element dropped on, and the ajax-update i working like a charm, but the _getRealHierarchicalIndex seems to return 0 every time.
function
OnClientDropping(sender, args) {
var
orgChart = $find(
"<%= RadOrgChart1.ClientID %>"
);
var
itemText = args.get_sourceItem().get_text().trim();
if
(args.get_htmlElement().className.indexOf(
"rocItem"
) != -1 || $(args.get_htmlElement()).parents(
".rocItem"
).length > 0) {
var
hierarchicalIndex = orgChart._extractNodeFromDomElement(args.get_htmlElement())._getHierarchicalIndex();
hierarchicalIndex = orgChart._getRealHierarchicalIndex(hierarchicalIndex);
//gets right index if drill down is on
$find(
"<%= RadAjaxManager2.ClientID %>"
).ajaxRequest(
"drop-"
+ itemText +
"-"
+ hierarchicalIndex);
}
dropClue.style.display =
"none"
;
noDropClue.style.display =
"none"
;
}
As you can see, I have only changed the rocGroup to a rocItem, and ofcause it gives me some problems in the RadAjaxManager2_AjaxRequest, cause the ids contains ether 0 or 0:0
Here's the start of the AjaxRequest:
char
[] seps = {
'-'
};
string
[] textAndIds = e.Argument.Split(seps, StringSplitOptions.None);
char
[] sep = {
':'
};
string
[] stringIds = textAndIds[2].Split(sep, StringSplitOptions.RemoveEmptyEntries);
int
[] ids =
new
int
[stringIds.Length];
for
(
int
i = 0; i < stringIds.Length; i++)
{
ids[i] = Int32.Parse(stringIds[i]);
}
if
(textAndIds[0] ==
"drop"
)
{
string
newText = textAndIds[1];
OrgChartNode node = RadOrgChart1.GetNodeByHierarchicalIndex(ids);
var rows = from myRow
in
initialeEmployees.AsEnumerable() where myRow.Field<
string
>(
"FullName"
) == newText select
new
{ values = myRow };
string
imageUrl =
""
;
string
emloyeeId =
""
;
foreach
(var row
in
rows)
{
imageUrl = row.values.Field<
string
>(
"ImageUrl"
);
emloyeeId = row.values.Field<
string
>(
"EmployeeID"
);
break
;
}
employees.Rows.Add(
new
string
[] { emloyeeId, node.ID, newText, imageUrl });
}