May 09, 2013, 6:25 PM
[CLOSED] Command's HideMode is not honered during PrepareToolbar (Hiding a Command)
In the following example, when the command is hidden during PrepareToolbar event, the dimensions of the command are not maintained. It was supposed to maintain the dimensions since the Command's HideMode property is set to 'offsets'
That's what sencha says about HideMode property: http://docs.sencha.com/extjs/4.1.3/#...t-cfg-hideMode
It's possible tom reproduce the issue by mouse over the 'ODD' rows.
That's what sencha says about HideMode property: http://docs.sencha.com/extjs/4.1.3/#...t-cfg-hideMode
'offsets' : The Component will be hidden by absolutely positioning it out of the visible area of the document. This is useful when a hidden Component must maintain measurable dimensions. Hiding using display results in a Component having zero dimensions.
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<script type="text/javascript">
var prepareToolbar = function (toolbar, record) {
var command = toolbar.items.get(0);
if (parseInt(record.raw.id) % 2 == 0) {
command.show();
}
else {
command.hide();
}
};
</script>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:TreePanel ID="_tpnl" RootVisible="false" Title="Ext.Net" HideHeaders="true"
Height="300" Width="300" Margin="10" runat="server">
<Store>
<ext:TreeStore ID="TreeStore1" runat="server">
<Proxy>
<ext:AjaxProxy Url="/Example/LoadFakeChildren">
<ActionMethods Read="POST" />
<Reader>
<ext:JsonReader Root="data" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="Task" />
</Fields>
</ext:Model>
</Model>
</ext:TreeStore>
</Store>
<Root>
<ext:Node NodeID="0" Text="Root" />
</Root>
<ColumnModel>
<Columns>
<ext:TreeColumn ID="TreeColumn1" Text="Task" DataIndex="Task" Flex="2" runat="server" />
<ext:CommandColumn ID="CommandColumn1" OverOnly="True" Width="25" MinWidth="25" MaxWidth="25"
runat="server">
<Commands>
<ext:GridCommand CommandName="abrirAplicacaoComDuplicidade" HideMode="Offsets" Icon="BulletPlus" />
</Commands>
<PrepareToolbar Handler="prepareToolbar(toolbar, record);" />
</ext:CommandColumn>
</Columns>
</ColumnModel>
</ext:TreePanel>
</body>
</html>
namespace SandBox.Controllers
{
public class ExampleController : System.Web.Mvc.Controller
{
public ActionResult Index()
{
return View();
}
public StoreResult LoadFakeChildren()
{
NodeCollection nodes = new NodeCollection(false);
for (int index = 1; index < 6; index++)
{
Node node = new Node
{
NodeID = index.ToString()
};
node.CustomAttributes.Add(new ConfigItem
{
Name = "Task",
Value = ((index % 2 == 0) ? string.Format("{0} - OK", index) : string.Format("{0} - Fail - Hover me", index)),
Mode = ParameterMode.Value
});
nodes.Add(node);
}
return new StoreResult
{
Data = nodes.ToJson()
};
}
}
}
Last edited by Daniil; Nov 14, 2013 at 4:38 AM.
Reason: [CLOSED]