Hi Telerik,
Could you please clarify if this is expected behavior?
I am programatically setting the ForbiddenZones property of every dock on my page. I do so like this:
I have found that there is a discrepancy between how Telerik's Client and Server code interpret ForbiddenZones.
If I leave my forbidden zones as just "DockZoneID" then this code works fine:
but when I drag a dock onto an already populated dock zone, even though the zone glows red, I am still able to drop the dock onto the dock zone.
Yet, observe that if I strip of the "RadDockZone_" header -- thus making it the DockZone's UniqueName -- now the dock is unable to dock onto the dockzone in question.
Yet, observe that if I only add the DockZone's UniqueName property to the dock's ForbiddenZone array that the above JavaScript stops functioning.
The client side appears to care about the ID of the zone, the server side cares about the UniqueName. If this is intended, why? It is a hassle to comment why I am storing two values when only one is necessary to determine uniqueness.
Could you please clarify if this is expected behavior?
I am programatically setting the ForbiddenZones property of every dock on my page. I do so like this:
/// <summary>
/// Shows where docks can/can't be moved. Forbidden zones are all DockZone's with Docks.
/// </summary>
private
void
SynchForbiddenZones(RadDockLayout dockLayout)
{
Logger.Info(
"Synching forbidden zones"
);
IEnumerable<CormantRadDock> docks = dockLayout.RegisteredDocks.OfType<CormantRadDock>();
foreach
(CormantRadDock dock
in
docks)
{
List<
string
> forbiddenZones =
new
List<
string
>();
foreach
(CormantRadDock otherDock
in
docks.Where(otherDock => otherDock != dock && !otherDock.GetState().Closed))
{
forbiddenZones.Add(otherDock.DockZoneID);
forbiddenZones.Add(otherDock.DockZoneID.Replace(
"RadDockZone_"
,
""
));
//Why is this necessary?
}
dock.ForbiddenZones = forbiddenZones.ToArray();
}
}
I have found that there is a discrepancy between how Telerik's Client and Server code interpret ForbiddenZones.
If I leave my forbidden zones as just "DockZoneID" then this code works fine:
function
OnClientDragStart(dock) {
var
forbiddenZones = dock.get_forbiddenZones();
for
(
var
zoneId
in
forbiddenZones) {
var
zone = $find(forbiddenZones[zoneId]);
if
(zone !=
null
) {
var
zoneElement = zone.get_element();
Sys.UI.DomElement.addCssClass(zoneElement,
"zoneDropNotOk"
);
}
}
}
function
OnClientDragEnd(dock) {
var
forbiddenZones = dock.get_forbiddenZones();
for
(
var
zoneId
in
forbiddenZones) {
var
zone = $find(forbiddenZones[zoneId]);
if
(zone !=
null
) {
var
zoneElement = zone.get_element();
Sys.UI.DomElement.removeCssClass(zoneElement,
"zoneDropNotOk"
);
}
}
}
but when I drag a dock onto an already populated dock zone, even though the zone glows red, I am still able to drop the dock onto the dock zone.
Yet, observe that if I strip of the "RadDockZone_" header -- thus making it the DockZone's UniqueName -- now the dock is unable to dock onto the dockzone in question.
Yet, observe that if I only add the DockZone's UniqueName property to the dock's ForbiddenZone array that the above JavaScript stops functioning.
The client side appears to care about the ID of the zone, the server side cares about the UniqueName. If this is intended, why? It is a hassle to comment why I am storing two values when only one is necessary to determine uniqueness.