Mar 01, 2015, 11:16 PM
[FIXED] [#740] [3.2.0] Grid Group: Show/Hide column that is grouped
In the grid feature
Reading the Sencha docs there should be a GroupChange event on the grid that I think would help do the trick, but it is not available. It this an oversight?
Any other suggestions?
See the related threads:
ext:Grouping
there is an attribute HideGroupedHeader
that will hide or show the column that is being grouped. I would like to control this based on certain columns. The reason why is that when I group a date column I group it my Month and Year, so it is still important to show this column when being grouped, but not the other columns.Reading the Sencha docs there should be a GroupChange event on the grid that I think would help do the trick, but it is not available. It this an oversight?
Any other suggestions?
See the related threads:
<%@ Page Language="C#" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
DateTime today = DateTime.Today;
DateTime later = DateTime.Today.AddMonths(1);
Store store = this.GridPanel1.GetStore();
store.DataSource = new object[]
{
new object[] { today.AddHours(1), "1", "1" },
new object[] { today.AddHours(2), "11", "11" },
new object[] { today.AddHours(3), "111", "111" },
new object[] { later.AddHours(1), "2", "2" },
new object[] { later.AddHours(2), "22", "22" },
new object[] { later.AddHours(3), "222", "222" }
};
}
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
<script>
var getGroupString = function getGroupString(rec) {
return Ext.Date.format(rec.get('datetime'), 'F Y');
};
var group = function (groupers, direction) {
var grouper;
if (Ext.isString(groupers) && (groupers === "datetime")) {
grouper = this.groupers.get(groupers);
if (!grouper) { // If it is not currently grouped by the datetime field
groupers = {
direction: "DESC",
property: "datetime",
getGroupString: getGroupString
}
}
}
Ext.data.Store.prototype.group.apply(this, [groupers, direction]);
};
</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="datetime" Type="Date" />
<ext:ModelField Name="test1" />
<ext:ModelField Name="test2" />
</Fields>
</ext:Model>
</Model>
<Groupers>
<ext:DataSorter Property="datetime" Direction="DESC">
<CustomConfig>
<ext:ConfigItem Name="getGroupString" Value="getGroupString" Mode="Raw" />
</CustomConfig>
</ext:DataSorter>
</Groupers>
<CustomConfig>
<ext:ConfigItem Name="group" Value="group" Mode="Raw" />
</CustomConfig>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:DateColumn runat="server" Text="DateTime" DataIndex="datetime" Format="yyyy-MM-dd hh:mm" />
<ext:Column runat="server" Text="Test1" DataIndex="test1" />
<ext:Column runat="server" Text="Test2" DataIndex="test2" />
</Columns>
</ColumnModel>
<Features>
<ext:Grouping runat="server" HideGroupedHeader="true" />
</Features>
</ext:GridPanel>
</form>
</body>
</html>
Last edited by cwolcott; Mar 02, 2015 at 11:32 PM.