Jan 28, 2013, 8:16 PM
bug is found?: toolbar and record are different in prepareCommand when Grouping gridPanel
Hi,
I have a GridPanel with grouping by boolean field. GridPanel has a CommandColumn with two commands: Start and Stop. Only one command should be visible at time and it's depending from group field (if 'field == true' should show Start command and if 'field == false' should show Stop command).
Set command visible state I doing in prepareToolbar function, but I was surprised that toolbar and record are different, it's mean that toolbar for second row but record for third row, and I can't set command visible state properly.
How make sure toolbar showing correct record data of command?
p.s. if I remove grouping all works fine.
I have a GridPanel with grouping by boolean field. GridPanel has a CommandColumn with two commands: Start and Stop. Only one command should be visible at time and it's depending from group field (if 'field == true' should show Start command and if 'field == false' should show Stop command).
Set command visible state I doing in prepareToolbar function, but I was surprised that toolbar and record are different, it's mean that toolbar for second row but record for third row, and I can't set command visible state properly.
How make sure toolbar showing correct record data of command?
p.s. if I remove grouping all works fine.
<ext:GridPanel ID="gridPanelCars" runat="server" Header="False" Border="False">
<Store>
<ext:Store runat="server" GroupField="IsTracked">
<Model>
<ext:Model ID="Model1" runat="server" IDProperty="Id">
<Fields>
<ext:ModelField Name="Id" />
<ext:ModelField Name="Name" Type="String" />
<ext:ModelField Name="Speed" Type="Float" />
<ext:ModelField Name="LastSendTime" />
<ext:ModelField Name="IsTracked">
</ext:ModelField>
</Fields>
</ext:Model>
</Model>
<Sorters>
<ext:DataSorter Property="IsTracked" Direction="DESC" />
</Sorters>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server" ForceFit="True" Selectable="False">
<Columns>
<ext:Column ID="Column1" runat="server" Text="Название" DataIndex="Name">
</ext:Column>
<ext:Column ID="Column2" runat="server" Text="Описание" DataIndex="Speed" Flex="1">
</ext:Column>
<ext:Column runat="server" DataIndex="IsTracked">
</ext:Column>
<ext:CommandColumn ID="CommandColumn1" runat="server">
<Commands>
<ext:GridCommand Icon="CarStart" CommandName="CarStart">
<ToolTip Text="Начать трекинг" />
</ext:GridCommand>
<ext:GridCommand Icon="CarStop" CommandName="CarStop">
<ToolTip Text="Остановить трекинг" />
</ext:GridCommand>
</Commands>
<Listeners>
<Command Fn="Repository.executeRepositoryCommand" />
</Listeners>
<PrepareToolbar Fn="Repository.prepareRepositoryCommand">
</PrepareToolbar>
</ext:CommandColumn>
</Columns>
</ColumnModel>
<View>
<ext:GridView ID="GridView1" runat="server">
</ext:GridView>
</View>
<Plugins>
<ext:CellEditing ID="CellEditing1" runat="server">
</ext:CellEditing>
</Plugins>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" Mode="Multi">
<Listeners>
</Listeners>
</ext:RowSelectionModel>
</SelectionModel>
<Features>
<ext:GroupingSummary ID="Group1" runat="server" GroupHeaderTplString="{groupValue}"
HideGroupedHeader="False" EnableGroupingMenu="false">
</ext:GroupingSummary>
</Features>
</ext:GridPanel>
and prepareToolbar function:Repository.prepareRepositoryCommand = function (grid, toolbar, rowIndex, record) {
if (record.get("IsTracked")) {
toolbar.items.items[0].hide();
} else {
toolbar.items.items[1].hide();
}
};
Last edited by retto; Jan 28, 2013 at 8:57 PM.