PDA

View Full Version : [CLOSED] Store.add + grouped GridPanel issue



Leonid_Veriga
Aug 28, 2012, 4:05 PM
Hello.

I faced with problem, when add more, then one record in the store. Find example below



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StoreAddTest.aspx.cs" Inherits="ExtJSTesApplication.StoreAddTest" %>
<%@ Import Namespace="System.Xml" %>


<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!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 runat="server">
<script type="text/javascript">
var storeLoaded = false;
function loadStore(store) {
if (!storeLoaded) {
var recordsToAdd = [];
recordsToAdd.push(new store.model({
Id: 1,
CapabilityName: 'cap1',
CategoryName: 'cat'
}));
// If comment folowwing model insertion, then error was not occured
recordsToAdd.push(new store.model({
Id: 2,
CapabilityName: 'cap2',
CategoryName: 'cat'
}));
//-----------------


store.add(recordsToAdd);
}
storeLoaded = true;
}


</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />

<ext:Store ID="CapabilitiesStore" runat="server" GroupField="CategoryName">
<Model>
<ext:Model ID="Model1" runat="server" IDProperty="Id">
<Fields>
<ext:ModelField Name="Id" Mapping="CapabilityId" />
<ext:ModelField Name="CapabilityName" />
<ext:ModelField Name="CategoryName" SortType="AsUCString" />
</Fields>
</ext:Model>
</Model>
<Sorters>
<ext:DataSorter Property="CapabilityNameSort" Direction="ASC" />
</Sorters>
<Listeners>
<Load Handler="loadStore(this)" />
</Listeners>
</ext:Store>


<ext:GridPanel ID="AvailableCapabilitiesGrid"
runat="server"
StoreID="CapabilitiesStore"
Collapsible="false"
TitleCollapse="true"
Frame="false"
AutoScroll="True"
Collapsed="False"
ScrollDelta="16"
ForceFit="true"
Flex="4">
<TopBar>
<ext:Toolbar ID="AvailableCapabilitiesToolbar" runat="server" Height="27" StyleSpec="padding-top:6px;">
<Items>
<ext:Label ID="AvailableCapabilitiesGridToolbarLabel" runat="server" Text="Available Capabilities" Cls="labelTitle" />
</Items>
</ext:Toolbar>
</TopBar>
<ColumnModel ID="AvailableCapabilitiesColumnModel" runat="server">
<Columns>
<ext:Column ID="Column1" runat="server" Text="Capability" Width="250" DataIndex="CapabilityNameSort" Sortable="false" Groupable="false" MenuDisabled="true">

</ext:Column>
<ext:Column ID="Column2" runat="server" Text="Capability Group" Width="50" DataIndex="CategoryName" Groupable="false" />
</Columns>
</ColumnModel>
<SelectionModel>
<ext:CheckboxSelectionModel ID="AvailableCapabilitiesSelectionModel" runat="server" Mode="Simple" ShowHeaderCheckbox="false" />
</SelectionModel>
<View>
<ext:GridView ID="GroupingView3" runat="server"
TrackOver="true"
StripeRows="true" />
</View>
<Features>
<ext:Grouping ID="Grouping1" runat="server"
HideGroupedHeader="true"
GroupHeaderTplString='{name}' />
</Features>
</ext:GridPanel>
</form>
</body>
</html>



Could you help me to solve this issue?

Daniil
Aug 28, 2012, 6:04 PM
Hi,

Please edit the post wrapping the code in
tags.

For now we can suggest the following workaround: replace
[CODE]store.add(recordsToAdd);
with

grid.getView().blockRefresh = true;
store.add(recordsToAdd);
grid.getView().blockRefresh = false;
grid.getView().refresh();

You should also pass the "grid" (or directly its view) into the loadStore function.

Though it looks like a bug. We will investigate further and come back with an update.

Leonid_Veriga
Aug 29, 2012, 11:06 AM
Thank you, Daniil.
It works for me.

Daniil
Sep 03, 2012, 6:11 PM
It has been fixed in SVN. After update from the 2.1 branch, you can remove the workaround.

Thanks again for the report!