PDA

View Full Version : [CLOSED] Hide expander column



RRD
Jul 11, 2013, 11:48 AM
I've found how to hide "plus". Is it possible to hide whole column with plus? I need to hide column that marked red in picture.
6528

Daniil
Jul 11, 2013, 2:46 PM
Hi @RRD,

Please use:


var view = App.GridPanel1.getView();

if (view.lockedView) {
view = view.lockedView;
}

view.headerCt.items.getAt(0).hide(); // "show" to show

RRD
Jul 15, 2013, 1:29 PM
Hi @RRD,

Please use:


var view = App.GridPanel1.getView();

if (view.lockedView) {
view = view.lockedView;
}

view.headerCt.items.getAt(0).hide(); // "show" to show


It works fine when I call from browser console. When I need to call this code? What event should I use?

Daniil
Jul 15, 2013, 2:25 PM
Do you need for the initial state of GridPanel?

So, you do need a RowExpander, but do not need a column with a +/- column at all?

RRD
Jul 15, 2013, 2:30 PM
Do you need for the initial state of GridPanel?

So, you do need a RowExpander, but do not need a column with a +/- column at all?

Yes, I do need a RowExpander, but do not need a column with a +/-.

Daniil
Jul 15, 2013, 2:45 PM
Please try a GridPanel's AfterRender event.

Example

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Store store = this.GridPanel1.GetStore();
store.DataSource = new object[]
{
new object[] { "test1", "test2", "test3" },
new object[] { "test4", "test5", "test6" },
new object[] { "test7", "test8", "test9" }
};
}
}
</script>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>

<script>
var onBeforeRender = function (grid) {
var view = grid.getView();

if (view.lockedView) {
view = view.lockedView;
}

view.headerCt.items.getAt(0).hide();
};
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server">
<Store>
<ext:Store runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="test1" />
<ext:ModelField Name="test2" />
<ext:ModelField Name="test3" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Test1" DataIndex="test1" />
<ext:Column runat="server" Text="Test2" DataIndex="test2" />
<ext:Column runat="server" Text="Test3" DataIndex="test3" />
</Columns>
</ColumnModel>
<Plugins>
<ext:RowExpander runat="server" />
</Plugins>
<Listeners>
<AfterRender Fn="onBeforeRender" />
</Listeners>
</ext:GridPanel>
</form>
</body>
</html>

I think we should investigate a possibility to get it configurable.

RRD
Jul 15, 2013, 4:40 PM
Thanks for help, Daniil. You can close this thread.

Daniil
Jul 29, 2013, 4:37 AM
We added the HiddenColumn property for a RowExpander. It will go to the upcoming v2.3 release.

Example

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Store store = this.GridPanel1.GetStore();
store.DataSource = new object[]
{
new object[] { "test1", "test2", "test3" },
new object[] { "test4", "test5", "test6" },
new object[] { "test7", "test8", "test9" }
};
}
}
</script>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server">
<Store>
<ext:Store runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="test1" />
<ext:ModelField Name="test2" />
<ext:ModelField Name="test3" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Test1" DataIndex="test1" />
<ext:Column runat="server" Text="Test2" DataIndex="test2" />
<ext:Column runat="server" Text="Test3" DataIndex="test3" />
</Columns>
</ColumnModel>
<Plugins>
<ext:RowExpander runat="server" HiddenColumn="true" />
</Plugins>
</ext:GridPanel>

<ext:Button runat="server" Text="Show" Handler="App.GridPanel1.getRowExpander().expanderColumn.sho w();" />

<ext:Button runat="server" Text="Hide" Handler="App.GridPanel1.getRowExpander().expanderColumn.hid e();" />
</form>
</body>
</html>