PDA

View Full Version : [CLOSED] How to implement RowEditing for newly added row in CellEditing GridPanel



iansriley
Nov 10, 2015, 12:17 PM
Hi,

Can any one please give me the solution for the following criteria. Which is

I have a GridPanel with CellEditing Plugin

I was adding a new row on ViewReady listener like

function onGridReady(item) {
var me = item,
view = me.view,
grid = me.view.up('gridpanel');

grid.store.insert(grid.store.getCount(), { });

var pos = grid.getStore().getCount() - 1;
grid.selModel.selectByPosition(pos);

// Here I just need to display entire new row as editable with Add button
// Below code is to edit the first cell of newly added row
grid.editingPlugin.startEdit(pos, 0);
}

I have tried from StartEdit and startEditByPosition as well. But these 2 methods to edit the Cells only, not for the entire row.

Here the new row should be always editable.

My Grid looks like below


<ext:GridPanel ID="gridExample" runat="server" StoreID="storeExample" Border="true" Height="100" Scroll="Both" Layout="FitLayout">
<ColumnModel ID="ColumnModel2" runat="server">
<Columns>
<ext:ImageCommandColumn ID="columnGo" runat="server" Align="Right" Text="" Hideable="true" Width="25">
<Commands>
<ext:ImageCommand CommandName="GotoPage" Icon="PageWhiteGo" Text="" Style="margin: 1px 1px 0px 2px !important">
<ToolTip Text="Go to Page" />
</ext:ImageCommand>
</Commands>
<PrepareCommand Fn="gotoPageCommand" />
</ext:ImageCommandColumn>
<ext:Column runat="server" ID="Column12" DataIndex="Type" Text="Type" Flex="1">
<Editor>
<ext:ComboBox ID="cboType" runat="server" StoreID="storeType" DisplayField="Display" ValueField="Display">
</ext:ComboBox>
</Editor>
</ext:Column>
<ext:Column runat="server" ID="Column11" DataIndex="FirstName" Text="First Name" Flex="1" EmptyCellText="First Name">
<Editor>
<ext:TextField ID="TextField5" runat="server">
</ext:TextField>
</Editor>
</ext:Column>
..............................
</Columns>
</ColumnModel>
<View>
<ext:GridView ID="GridView2" runat="server" StripeRows="true" TrackOver="false" />
</View>
<Plugins>
<ext:CellEditing ClicksToEdit="1">
</ext:CellEditing>
</Plugins>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
</SelectionModel>
<Listeners>
<ViewReady Handler="onGridReady(this);" />
</Listeners>
</ext:GridPanel>


Thank you

Daniil
Nov 10, 2015, 12:32 PM
Hi @iansriley,

Unfortunately, CellEditing can show an editor for a single cell only. Also CellEditing cannot be mixed with RowEditing.

Off the top of my head, I would recommend to consider changing the approach to something else. For example, before adding a row, you could show a special form where a user can fill out all the fields and the row would be added to a GridPanel after clicking the Add button.