PDA

View Full Version : GroupingSummary - Not show the sum



Maia
Jan 20, 2010, 4:35 PM
Hi,
I need to use GroupingSummary but it does not show the total. I checked the example:


http://examples1.ext.net/#/GridPanel/Plugins/GroupingSummary/

The difference is that in my FORM I use ViewPort.


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GrdFatura.aspx.cs" Inherits="RegistroWpe.View.GrdFatura" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<%@ Register Src="~/View/FrmPersonalizacao.ascx" TagName="Persona" TagPrefix="UC1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<script language="javascript" type="text/javascript" src="../Content/Js/BmaValidacao.js"></script>
<title></title>
<link rel="stylesheet" type="text/css" href="../Content/Css/Stylesheet1.css" />
<style type="text/css">
.cbxDistribuidor-list
{
width: 298px;
font: 11px tahoma,arial,helvetica,sans-serif;
}

.cbxDistribuidor-list th {
font-weight: bold;
}

.cbxDistribuidor-list td, .cbxDistribuidor-list th {
padding: 3px;
}
</style>

<script type="text/javascript" language="javascript">

function ShowContextMenu(DeletedValue) {
}

function alertCancelado() {

GridPanel1 = eval('<%=grdPersona.ClientID%>');
if (GridPanel1.getSelectionModel().getSelected().data .prsPedidoCancelado)
return false;
else
return true;

}

function alertDeletePersonalizacao() {
GridPanel1 = eval('<%=grdPersona.ClientID%>');
if (GridPanel1.hasSelection())
// &amp;&amp; (!GridPanel1.getSelectionModel().getSelected().dat a.prsPedidoCancelado))
return "Confirma Cancelamento? <br>[B] " + GridPanel1.getSelectionModel().getSelected().data. prsRazaoSocial + "[B]";

}


function convertTipoLicenca(v) {
if (v == "N") {
return "Cópia Nova";
}
if (v == "A") {
return "Atualização";
}
if (v == "L") {
return "Locação";
}
return v;
}

</script>

<ext:ScriptManager ID="ScriptManager1" runat="server">


</ext:ScriptManager>
<ext:Store ID="StorePersona" runat="server" AutoLoad="true" RefreshAfterSaving="Auto"
WarningOnDirty="false" SerializationMode="Complex" >
<Reader>
<ext:JsonReader ReaderID="prsId" >
<Fields>
<ext:RecordField Name="prsId" />
<ext:RecordField Name="prsNumeroInscricao" />
<ext:RecordField Name="prsRazaoSocial" />
<ext:RecordField Name="prsNumeroSerie" />
<ext:RecordField Name="prsDataCadastro" Type="Date" />
<ext:RecordField Name="prsDataRegistro" Type="Date" />
<ext:RecordField Name="prsTipoLicenca" />
<ext:RecordField Name="prsComContrato" Type="Boolean" />
<ext:RecordField Name="prsNumeroFuncionarios" />
<ext:RecordField Name="prsNumeroUsuarios" />
<ext:RecordField Name="prsPedidoCancelado" Type="Boolean" />
<ext:RecordField Name="prsValorPedido" />
<ext:RecordField Name="prsValorContrato" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:Store ID="StoreDistribuidor" runat="server" AutoLoad="true" >
<Reader>
<ext:JsonReader ReaderID="dstId">
<Fields>
<ext:RecordField Name="dstId"/>
<ext:RecordField Name="dstRazaoSocial"/>
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</head>

<body>
<form runat="server" id="form1">
<ext:Menu ID="ContextMenu" runat="server">
<Items>
<ext:MenuItem ID="mnuEdit" runat="server" Visible="true" Text="Editar" Icon="ApplicationEdit">
<Listeners>
<Click Handler="#{btnEditar}.fireEvent('click')" />
</Listeners>
</ext:MenuItem>
</Items>
</ext:Menu>

<ext:ViewPort runat="server" ID="ViewPort1">
<Body>
<ext:FitLayout ID="FitLayout1" runat="server">
<ext:GridPanel ID="grdPersona" runat="server" StoreID="storePersona" Border="false"
TrackMouseOver="true" Header="false" ContextMenuID="ContextMenu" >
<TopBar>
<ext:Toolbar ID="Toolbar1" runat="server">
<Items>
<ext:ToolbarButton ID="btnAtualizar" runat="server" Icon="Accept">
<AjaxEvents>
<Click OnEvent="Atualizar">
<EventMask ShowMask="true" Msg="Atualizado Registros ..." />
<ExtraParams>
<ext:Parameter Name="GrdPersona" Value="Ext.encode(#{grdPersona}.getRowsValues(false))" Mode="Raw" />
</ExtraParams>
</Click>
</AjaxEvents>
<ToolTips>
<ext:ToolTip ID="ToolTip1" runat="server" Html="Atualizar Valores">
</ext:ToolTip>
</ToolTips>
</ext:ToolbarButton>
<ext:ToolbarSeparator ID="ToolbarSeparator12" runat="server">
</ext:ToolbarSeparator>
<ext:ToolbarButton ID="btnEditar" runat="server" Icon="ApplicationEdit" Enabled="false">
<AjaxEvents>
<Click OnEvent="Editar">
<ExtraParams>
<ext:Parameter Name="id" Value="#{grdPersona}.getSelectionModel().hasSelection() ? #{grdPersona}.getSelectionModel().getSelected().da ta.prsId : -1"
Mode="Raw" />
</ExtraParams>
</Click>
</AjaxEvents>
<ToolTips>
<ext:ToolTip ID="ToolTip2" runat="server" Html="Editar Personalização">
</ext:ToolTip>
</ToolTips>
</ext:ToolbarButton>
<ext:ToolbarSeparator ID="ToolbarSeparator2" runat="server">
</ext:ToolbarSeparator>

<ext:ToolbarFill ID="ToolbarFill1" runat="server"> </ext:ToolbarFill>
<ext:ComboBox
ID="cbxDistribuidor"
runat="server"
EmptyText="Distribuidor"
TypeAhead="true"
ForceSelection="true"
StoreID="StoreDistribuidor"
DisplayField="dstRazaoSocial"
ValueField="dstId"
MinChars="1"
ListWidth="200"
PageSize="10"
ItemSelector="tr.list-item">
<Template ID="Template1" runat="server">
<tpl for=".">
<tpl if="[xindex] == 1">
<table class="cbxDistribuidor-list">
<tr>
<th>Distribuidor</th>
</tr>
</tpl>
<tr class="list-item">
<td style="padding:3px 0px;">{dstRazaoSocial}</td>
</tr>
<tpl if="[xcount-xindex]==0">
</table>
</tpl>
</tpl>
</Template>
<AjaxEvents>
<Select OnEvent="Distribuidor"></Select>
</AjaxEvents>
</ext:ComboBox>
<ext:ToolbarSeparator ID="ToolbarSeparator1" runat="server"></ext:ToolbarSeparator>
<ext:Label runat="server" ID="lblPeriodo" Text="Período:"></ext:Label>
<ext:ToolbarSpacer ID="ToolbarSpacer1" runat="server"></ext:ToolbarSpacer>
<ext:DateField ID="txtDataInicial" runat="server" Format="dd/MM/yyyy"
AllowBlank="false" Width="100" BlankText="Campo obrgatório" Vtype="daterange">
<Listeners>
<Render Handler="this.endDateField = '#{txtDataFinal}'" />
</Listeners>
</ext:DateField>
<ext:ToolbarSeparator ID="ToolbarSeparator3" runat="server"></ext:ToolbarSeparator>
<ext:DateField ID="txtDataFinal" runat="server" Format="dd/MM/yyyy"
AllowBlank="false" Width="100" BlankText="Campo obrgatório" Vtype="daterange">
<Listeners>
<Render Handler="this.endDateField = '#{txtDataFinal}'" />
</Listeners>
</ext:DateField>
</Items>
</ext:Toolbar>
</TopBar>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ColumnID="prsId" Header="prsId" Width="50" Hidden="true" DataIndex="prsId">
</ext:Column>
<ext:CheckColumn Header="Cancelado" Width="65" Sortable="true" DataIndex="prsPedidoCancelado" />
<ext:Column ColumnID="dstRazaoSocial" Header="Distribuidor" Width="120" Sortable="true"
DataIndex="dstRazaoSocial">
</ext:Column>
<ext:Column ColumnID="prsNumeroSerie" Header="No.Série" Width="60" Sortable="true"
DataIndex="prsNumeroSerie">
</ext:Column>
<ext:Column ColumnID="prsRazaoSocial" Header="Razao Social" Width="200" Sortable="true"
DataIndex="prsRazaoSocial">
</ext:Column>
<ext:Column ColumnID="prsDataCadastro" Header="Data Cadastro" Width="80" Sortable="true" Align="Center"
DataIndex="prsDataCadastro">
<Renderer Fn="Ext.util.Format.dateRenderer('d/m/Y')" />
</ext:Column>
<ext:Column ColumnID="prsDataRegistro" Header="Data Liberação" Width="80" Sortable="true" Align="Center"
DataIndex="prsDataRegistro">
<Renderer Fn="Ext.util.Format.dateRenderer('d/m/Y')" />
</ext:Column>
<ext:Column ColumnID="prsTipoLicenca" Header="Tipo Licença" Width="100" Sortable="true"
DataIndex="prsTipoLicenca">
<Renderer Fn="convertTipoLicenca" />
</ext:Column>
<ext:Column ColumnID="prsNumeroFuncionarios" Header="NF" Width="50" Sortable="true"
DataIndex="prsNumeroFuncionarios">
</ext:Column>
<ext:Column ColumnID="prsNumeroUsuarios" Header="NU" Width="40" Sortable="true"
DataIndex="prsNumeroUsuarios">
</ext:Column>
<ext:GroupingSummaryColumn ColumnID="prsValorPedido"
Header="Valor Pedido"
Width="75"
Align="Right"
Sortable="true"
DataIndex="prsValorPedido"
SummaryType="Sum"
>
<Renderer Fn="FormatarValorGrid" />
<SummaryRenderer Fn="FormatarValorGrid" />
<Editor>
<ext:TextField runat="server" ID="txtValorPedido"></ext:TextField>
</Editor>
</ext:GroupingSummaryColumn>
<ext:Column ColumnID="prsValorContrato" Header="Valor Contrato" Width="80" Align="Right" Sortable="true" DataIndex="prsValorContrato">
<Renderer Fn="FormatarValorGrid" />
<Editor>
<ext:TextField runat="server" ID="txtValorContrato"></ext:TextField>
</Editor>
</ext:Column>
<ext:CheckColumn Header="Contrato" Width="50" Sortable="true" DataIndex="prsComContrato" />
</Columns>
</ColumnModel>
<View>
<ext:GroupingView ID="GroupingView1" HideGroupedColumn="true" runat="server" ForceFit="true" StartCollapsed="false" EnableRowBody="true">
</ext:GroupingView>
</View>

<Plugins>
<ext:GroupingSummary ID="GroupingSummary1" runat="server" />
<ext:GridFilters runat="server" ID="GridFilters1" Local="true" FiltersText="Filtro">
<Filters>
<ext:StringFilter DataIndex="dstRazaoSocial" />
</Filters>
<Filters>
<ext:StringFilter DataIndex="prsNumeroInscricao" />
</Filters>
<Filters>
<ext:StringFilter DataIndex="prsRazaoSocial" />
</Filters>
<Filters>
<ext:StringFilter DataIndex="prsNumeroSerie" />
</Filters>
<Filters>
<ext:StringFilter DataIndex="usrNome" />
</Filters>
</ext:GridFilters>
</Plugins>
<Listeners>
<RowContextMenu Handler="ShowContextMenu(this.store.getAt(rowIndex).data.De leteDate);e.preventDefault(); this.getSelectionModel().selectRow(rowIndex); #{ContextMenu}.dataRecord = this.store.getAt(rowIndex);#{ContextMenu}.showAt(e .getXY());" />
</Listeners>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server">
<Listeners>
<RowSelect Handler="#{btnEditar}.enable(); " />
<RowDeselect Handler="if (!#{grdPersona}.hasSelection()) {#{btnEditar}.disable();}" />
</Listeners>
</ext:RowSelectionModel>
</SelectionModel>
</ext:GridPanel>
</ext:FitLayout>
<UC1:Persona ID="uc1" runat="server" />
</Body>
</ext:ViewPort>
</form>
</body>
</html>


Maia
Coolite 0.8.2

Maia
Jan 21, 2010, 6:21 AM
Hi!
Please, any tip?
Maia.