4 Answers, 1 is accepted
0
Mr. Plinko
Top achievements
Rank 1
answered on 02 Sep 2009, 03:05 PM
Are you wanting to add a close command when the dock is in a zone, but not have it be available when it isn't?
0
Alec
Top achievements
Rank 1
answered on 03 Sep 2009, 01:30 AM
Yes. Like it's created without any commands. but when dragged and dropped onto a zone, the close command appears.
0
Vyrban
Top achievements
Rank 1
answered on 03 Sep 2009, 12:12 PM
Ok, why don't you add it initially and when your dock / undock the RadDock from the zone just hide / show the command?
There is my proposition:
There is my proposition:
<body> |
<script type="text/javascript"> |
function DragEnd(dock, args) { |
var commandClose = dock.get_commands().Close; |
var dockdockZoneId = dock.get_dockZoneID(); |
if (dockZoneId == "") { |
commandClose.set_visible(false); |
} |
else { |
commandClose.set_visible(true); |
} |
} |
</script> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> |
<div> |
<telerik:RadDockZone ID="RadDockZone1" runat="server" Width="300px"> |
<telerik:RadDock ID="RadDock1" runat="server" DefaultCommands="Close" |
Width="290px" OnClientDragEnd="DragEnd"></telerik:RadDock> |
</telerik:RadDockZone> |
</div> |
</form> |
</body> |
0
Mr. Plinko
Top achievements
Rank 1
answered on 03 Sep 2009, 03:53 PM
Vyrban, you read my mind! I decided to do OnClientDockPositionChanged rather than OnClientDragEnd. Also, I had the dock be floating to start. Same Same but Different. :)
This makes it so when you start out with the dock floating, there is no [X] close, but when it is docked the [X] appears, then disappears when taken off a dock.
<script |
type="text/javascript"> |
function NoCloseFloats(dock) { |
var id = dock.get_dockZoneID(); |
if (id == "") { |
dock.get_commands().Close.set_visible(false); |
} |
else { |
dock.get_commands().Close.set_visible(true); |
} |
} |
</script> |
<telerik:RadDockLayout |
ID="RadDockLayout1" |
runat="server"> |
<telerik:RadDockZone |
ID="RadDockZone1" |
runat="server" Width="300px"> |
</telerik:RadDockZone> |
</telerik:RadDockLayout> |
<telerik:RadDock |
ID="RadDock1" |
runat="server" |
OnClientDockPositionChanged="NoCloseFloats" OnClientInitialize="NoCloseFloats"> |
<ContentTemplate> |
ABC |
</ContentTemplate> |
</telerik:RadDock> |
This makes it so when you start out with the dock floating, there is no [X] close, but when it is docked the [X] appears, then disappears when taken off a dock.