Feb 06, 2015, 1:26 PM
[CLOSED] Grid Group dropdown "Show In Groups" implementation
Does it make sense for the "Show In Groups" checkbox in the column dropdown to be disabled after unchecking it and coming off the dropdown, then looking at the dropdown again?
You are able to uncheck and check the box as long as the dropdown doesn't disappear. I assume in the background it knows the last grouped column because when you uncheck "Show In Groups" the column is not added back to the grid.
Just a thought ...
You are able to uncheck and check the box as long as the dropdown doesn't disappear. I assume in the background it knows the last grouped column because when you uncheck "Show In Groups" the column is not added back to the grid.
Just a thought ...
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>
<html>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (X.IsAjaxRequest)
return;
BuildStore();
}
private void BuildStore()
{
string seperator1 = " » ";
string seperator2 = " | ";
string premiumHelp2x = "<a href='http://forums.ext.net/forum.php' Target='_blank'>Ext.Net Forums</a>" + seperator1 +
"<a href='http://forums.ext.net/forumdisplay.php?13'>Premium</a>" + seperator1 +
"<a href='http://forums.ext.net/forumdisplay.php?17-2'>2.x Premium Help</a>";
List<object> data = new List<object>
{
new { Id = 53271, DateCreated = DateTime.Parse("2/5/2015 11:50"), Forum = premiumHelp2x, UrlTitle ="<a href='http://forums.ext.net/showthread.php?53271'>Grid Group: Show full datetime but group by month day year</a>", User="cwolcott", Status="Open"},
new { Id = 40901, DateCreated = DateTime.Parse("8/5/2014 14:20"), Forum = premiumHelp2x, UrlTitle="<a href='http://forums.ext.net/showthread.php?40901'>[CLOSED] Field focus problem</a>", User="matrixwebtech", Status="Closed" },
};
this.GridStore.DataSource = data;
this.GridStore.DataBind();
}
</script>
<head runat="server">
<title>Grid Grouping Example</title>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="GridPanel" runat="server" ClientIDMode="Static" >
<Store>
<ext:Store ID="GridStore" runat="server" GroupField="Forum">
<Model>
<ext:Model runat="server" IDProperty="Id">
<Fields>
<ext:ModelField Name="Id" />
<ext:ModelField Name="DateCreated" Type="Date" />
<ext:ModelField Name="Forum" Type="String" />
<ext:ModelField Name="UrlTitle" Type="String" />
<ext:ModelField Name="User" Type="String" />
<ext:ModelField Name="Status" Type="String" />
</Fields>
</ext:Model>
</Model>
<Groupers>
</Groupers>
<Listeners>
<GroupChange Handler="var isGrouped = this.isGrouped(); #{CartEcBtn}.setDisabled(!isGrouped);" />
</Listeners>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Id" DataIndex="Id" Width="50" Groupable="false" />
<ext:DateColumn runat="server" Text="Created" DataIndex="DateCreated" Format="Y-MM-dd hh:mm:ss a"
Width="170" />
<ext:Column runat="server" Text="User" DataIndex="User" Width="90" />
<ext:Column runat="server" Text="Status" DataIndex="Status" Width="60" />
<ext:Column runat="server" Text="Forum" DataIndex="Forum" Flex="1" />
<ext:Column runat="server" Text="Thread Title" DataIndex="UrlTitle" Flex="2" Groupable="false" />
</Columns>
</ColumnModel>
<SelectionModel>
<ext:CheckboxSelectionModel runat="server" Mode="Multi" />
</SelectionModel>
<Features>
<ext:Grouping ID="GridGrouping" runat="server" StartCollapsed="false" HideGroupedHeader="true">
<GroupHeaderTpl runat="server">
<Html>
<tpl if="groupField === 'DateCreated'">
{name} [{rows.length} Item{[values.rows.length > 1 ? 's' : '']}]
</tpl>
<tpl if="groupField === 'Forum'">
Forum: {name} [{rows.length} Item{[values.rows.length > 1 ? 's' : '']}]
</tpl>
<tpl if="groupField === 'User'">
Creator: {name} [{rows.length} Item{[values.rows.length > 1 ? 's' : '']}]
</tpl>
<tpl if="groupField === 'Title'">
Month Created: {name} [{rows.length} Item{[values.rows.length > 1 ? 's' : '']}]
</tpl>
<tpl if="groupField === 'Status'">
Status: {name} [{rows.length} Item{[values.rows.length > 1 ? 's' : '']}]
</tpl>
</Html>
</GroupHeaderTpl>
</ext:Grouping>
</Features>
<Listeners>
<AfterRender Handler="#{GridGrouping}.expanded = true;" />
</Listeners>
<TopBar>
<ext:Toolbar runat="server">
<Items>
<ext:Button ID="CartEcBtn" runat="server" Text="Expand/Collapse Groups" Icon="TableSort">
<Listeners>
<Click Handler="#{GridGrouping} [ #{GridGrouping}.expanded ? 'collapseAll' : 'expandAll'](); #{GridGrouping}.expanded = !#{GridGrouping}.expanded;" />
</Listeners>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
</ext:GridPanel>
</body>
</html>
Last edited by Daniil; Feb 12, 2015 at 10:43 AM.
Reason: [CLOSED]