在telerik中加载数据和扩展gridtableview可以正常工作,但是在尝试折叠时却无法正常工作。仅当我展开网格中的另一行时,折叠才起作用。为什么切换扩展和折叠不起作用?是telerik功能正在质疑还是其中存在错误?
更新: 代码
<telerik:RadGrid ID="RadGrid1" runat="server" Skin="Windows7" AutoGenerateColumns="false" OnItemDataBound="Radgrid1_OnItemDataBound" AllowFilteringByColumn="false"
GridLines="None" BorderWidth="1px" CellPadding="0" EnableViewState="true" OnPreRender="RadGrid1_PreRender" OnDetailTableDataBind="RadGrid1_DetailTableDataBind"
Height="625px" Width="100%" AllowSorting="true" PageSize="50" AllowPaging="true" OnCustomAggregate="RadGrid1_CustomAggregate"
OnExcelExportCellFormatting="exporter_ExcelCellFormatting">
<GroupingSettings CaseSensitive="false" />
<MasterTableView EditMode="Batch" CommandItemDisplay="Top" AllowFilteringByColumn="true" AllowMultiColumnSorting="false" OverrideDataSourceControlSorting="true"
Width="100%" UseAllDataFields="false" ShowFooter="true" FooterStyle-HorizontalAlign="Right" AllowCustomSorting="true" AutoGenerateColumns="false"
NoMasterRecordsText="No Records Display" HierarchyLoadMode="ServerOnDemand" DataKeyNames="Sales RepNo" Name="SalesRepGrid" HierarchyDefaultExpanded="false" PageSize="20">
<CommandItemSettings ShowAddNewRecordButton="false" ShowRefreshButton="false" ShowExportToExcelButton="true" ShowSaveChangesButton="false" ShowCancelChangesButton="false"/>
<SortExpressions>
<telerik:GridSortExpression FieldName="Sales RepNo" SortOrder="Ascending" />
</SortExpressions>
<ColumnGroups>
<telerik:GridColumnGroup Name="Cases" HeaderText="Cases" HeaderStyle-HorizontalAlign="Center" />
<telerik:GridColumnGroup Name="Revenue" HeaderText="Revenue" HeaderStyle-HorizontalAlign="Center" />
</ColumnGroups>
<DetailTables>
<telerik:GridTableView Name="CustomerReportGrid" runat="server" PageSize="10"><ColumnGroups>
<telerik:GridColumnGroup Name="CustomerNo" HeaderText="Customer No" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"/>
<telerik:GridColumnGroup Name="CustomerName" HeaderText="Customer Name" HeaderStyle-HorizontalAlign="Center" />
<telerik:GridColumnGroup Name="InvoiceDate" HeaderText="Last Purchase Date" HeaderStyle-HorizontalAlign="Center" />
<telerik:GridColumnGroup Name="Cases" HeaderText="Cases" HeaderStyle-HorizontalAlign="Center" />
<telerik:GridColumnGroup Name="Revenue" HeaderText="Revenue" HeaderStyle-HorizontalAlign="Center" />
</ColumnGroups>
<Columns>
<telerik:GridBoundColumn DataField="CustomerNo" UniqueName="CustomerNo" HeaderText="" ColumnGroupName="CustomerNo">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CustomerName" UniqueName="CustomerName" HeaderText="" ColumnGroupName="CustomerName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="InvoiceDate" UniqueName="InvoiceDate" HeaderText="" ColumnGroupName="InvoiceDate">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CM_cases" UniqueName="CM_cases" HeaderText="CM" ColumnGroupName="Cases" ItemStyle-HorizontalAlign="Right">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LM_cases" UniqueName="LM_cases" HeaderText="CM PY" ColumnGroupName="Cases" ItemStyle-HorizontalAlign="Right">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CM_LM_VAR" UniqueName="CM_LM_VAR" HeaderText="VAR" ColumnGroupName="Cases" ItemStyle-HorizontalAlign="Right">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="YTD" UniqueName="YTD" HeaderText="YTD" ColumnGroupName="Cases" ItemStyle-HorizontalAlign="Right">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="PYTD" UniqueName="PYTD" HeaderText="PYTD" ColumnGroupName="Cases" ItemStyle-HorizontalAlign="Right">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="YTD_PYTD_VAR" UniqueName="YTD_PYTD_VAR" HeaderText="YTD_PYTD_VAR" ColumnGroupName="Cases" ItemStyle-HorizontalAlign="Right">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CM_Rev" UniqueName="CM_Rev" HeaderText="CM" ColumnGroupName="Revenue" ItemStyle-HorizontalAlign="Right">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LM_Rev" UniqueName="LM_Rev" HeaderText="CM PY" ColumnGroupName="Revenue" ItemStyle-HorizontalAlign="Right">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CMRev_LMRev_VAR" UniqueName="CMRev_LMRev_VAR" HeaderText="VAR" ColumnGroupName="Revenue" ItemStyle-HorizontalAlign="Right">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="YTD_Rev" UniqueName="YTD_Rev" HeaderText="YTD" ColumnGroupName="Revenue" ItemStyle-HorizontalAlign="Right">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="PYTD_Rev" UniqueName="PYTD_Rev" HeaderText="PYTD" ColumnGroupName="Revenue" ItemStyle-HorizontalAlign="Right">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="YTDRev_PYTDRev_VAR" UniqueName="YTDRev_PYTDRev_VAR" HeaderText="VAR" ColumnGroupName="Revenue" ItemStyle-HorizontalAlign="Right">
</telerik:GridBoundColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
<PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true" />
<Columns>
<telerik:GridBoundColumn ReadOnly="true" DataField="Sales RepNo" HeaderText="Sales Rep No" UniqueName="SalesRepNo" ItemStyle-Width="70" HeaderStyle-Width="70" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" FilterControlWidth="50px"/>
<telerik:GridBoundColumn ReadOnly="true" DataField="Sales Rep" HeaderText="Sales Rep Name" UniqueName="SalesRepName" ItemStyle-Width="110" HeaderStyle-Width="110" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" FilterControlWidth="90px" />
<telerik:GridBoundColumn ReadOnly="true" DataField="CM_cases" Aggregate="Custom" FooterAggregateFormatString="{0}" HeaderText="CM" UniqueName="CM" ColumnGroupName="Cases" ItemStyle-HorizontalAlign="Right" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" FilterControlWidth="50px" AllowFiltering="false" />
<telerik:GridBoundColumn ReadOnly="true" DataField="LM_cases" Aggregate="Custom" FooterAggregateFormatString="{0}" HeaderText="CM PY" UniqueName="CMPY" ColumnGroupName="Cases" ItemStyle-HorizontalAlign="Right" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" FilterControlWidth="50px" AllowFiltering="false" />
<telerik:GridBoundColumn ReadOnly="true" DataField="CM_LM_VAR" Aggregate="Custom" FooterAggregateFormatString="{0}" HeaderText="VAR" UniqueName="MVAR" ColumnGroupName="Cases" ItemStyle-HorizontalAlign="Right" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" FilterControlWidth="50px" AllowFiltering="false" />
<telerik:GridBoundColumn ReadOnly="true" DataField="YTD" Aggregate="Custom" FooterAggregateFormatString="{0}" HeaderText="YTD" UniqueName="YTD" ColumnGroupName="Cases" ItemStyle-HorizontalAlign="Right" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" FilterControlWidth="50px" AllowFiltering="false" />
<telerik:GridBoundColumn ReadOnly="true" DataField="PYTD" Aggregate="Custom" FooterAggregateFormatString="{0}" HeaderText="PYTD" UniqueName="PYTD" ColumnGroupName="Cases" ItemStyle-HorizontalAlign="Right" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" FilterControlWidth="50px" AllowFiltering="false" />
<telerik:GridBoundColumn ReadOnly="true" DataField="YTD_PYTD_VAR" Aggregate="Custom" FooterAggregateFormatString="{0}" HeaderText="VAR" UniqueName="YVAR" ColumnGroupName="Cases" ItemStyle-HorizontalAlign="Right" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" FilterControlWidth="50px" AllowFiltering="false" />
<telerik:GridBoundColumn ReadOnly="true" DataField="CM_Rev" Aggregate="Custom" FooterAggregateFormatString="{0:C0}" HeaderText="CM" UniqueName="CMR" ColumnGroupName="Revenue" ItemStyle-HorizontalAlign="Right" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" FilterControlWidth="50px" AllowFiltering="false" />
<telerik:GridBoundColumn ReadOnly="true" DataField="LM_Rev" Aggregate="Custom" FooterAggregateFormatString="{0:C0}" HeaderText="CM PY" UniqueName="CMPYR" ColumnGroupName="Revenue" ItemStyle-HorizontalAlign="Right" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" FilterControlWidth="50px" AllowFiltering="false" />
<telerik:GridBoundColumn ReadOnly="true" DataField="CMRev_LMRev_VAR" Aggregate="Custom" FooterAggregateFormatString="{0:C0}" HeaderText="VAR" UniqueName="VARRM" ColumnGroupName="Revenue" ItemStyle-HorizontalAlign="Right" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" FilterControlWidth="50px" AllowFiltering="false" />
<telerik:GridBoundColumn ReadOnly="true" DataField="YTD_Rev" Aggregate="Custom" FooterAggregateFormatString="{0:C0}" HeaderText="YTD" UniqueName="RYTD" ColumnGroupName="Revenue" ItemStyle-HorizontalAlign="Right" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" FilterControlWidth="50px" AllowFiltering="false" />
<telerik:GridBoundColumn ReadOnly="true" DataField="PYTD_Rev" Aggregate="Custom" FooterAggregateFormatString="{0:C0}" HeaderText="PYTD" UniqueName="RPYTD" ColumnGroupName="Revenue" ItemStyle-HorizontalAlign="Right" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" FilterControlWidth="50px" AllowFiltering="false" />
<telerik:GridBoundColumn ReadOnly="true" DataField="YTDRev_PYTDRev_VAR" Aggregate="Custom" FooterAggregateFormatString="{0:C0}" HeaderText="VAR" UniqueName="VARRY" ColumnGroupName="Revenue" ItemStyle-HorizontalAlign="Right" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" FilterControlWidth="50px" AllowFiltering="false" />
</Columns>
</MasterTableView>
<ClientSettings>
<Scrolling AllowScroll="true" SaveScrollPosition="true" UseStaticHeaders="true" />
<Resizing AllowRowResize="false" EnableRealTimeResize="true" ResizeGridOnColumnResize="false"
AllowColumnResize="true"/>
</ClientSettings>
</telerik:RadGrid>
答案 0 :(得分:0)
已更改
的属性HierarchyLoadMode="ServerOnDemand"
到
HierarchyLoadMode="Client"
,它就像一种魅力。离开面对这个问题的人。