Ext.net行编辑旧值和新值

时间:2016-03-17 17:23:23

标签: extjs ext.net gridpanel listeners

基于此thread,我正在尝试从已编辑的行/单元格中获取旧值和新值。但 rowIndex 始终为空。我怎样才能得到这个值?还有另一种方法可以在服务器端捕获这些信息吗?

这是我的网格。谢谢!

<ext:GridPanel runat="server"
                                        Frame="true"
                                        Layout="FitLayout"
                                        MarginSpec="5 0 5 0"
                                        ID="Janelas01">
                                        <Store>
                                            ...
                                            </ext:Store>
                                        </Store>
                                        <ColumnModel runat="server">
                                            <Columns>
                                                ...
                                                <ext:Column runat="server"
                                                    DataIndex="Meta"
                                                    Text="Meta / H"
                                                    Flex="1"
                                                    Align="Center">
                                                    <Editor>
                                                        <ext:NumberField
                                                            runat="server"
                                                            AllowBlank="false"
                                                            AllowDecimals="true"
                                                            Step="0.01">
                                                        </ext:NumberField>
                                                    </Editor>
                                                </ext:Column>
                                            </Columns>
                                        </ColumnModel>
                                        <SelectionModel>
                                            <ext:RowSelectionModel runat="server" />
                                        </SelectionModel>
                                        <Plugins>
                                            <ext:RowEditing runat="server">
                                                <Listeners>
                                                    <BeforeEdit Handler="this.oldValues = Ext.net.clone(this.grid.getStore().getAt(rowIndex).data);" />
                                                </Listeners>
                                                <DirectEvents>
                                                    <Edit OnEvent="GridPanel_AfterEdit">
                                                        <ExtraParams>
                                                            <ext:Parameter Name="old" Value="this.oldValues" Mode="Raw" Encode="true" />
                                                            <ext:Parameter Name="new" Value="this.grid.getStore().getAt(rowIndex).data" Mode="Raw" Encode="true" />
                                                        </ExtraParams>
                                                    </Edit>
                                                </DirectEvents>
                                            </ext:RowEditing>
                                        </Plugins>
                                    </ext:GridPanel>

1 个答案:

答案 0 :(得分:0)

它已经解决了。积分@fabricio.murta

我只是改变了这段代码:

<Plugins>
            <ext:RowEditing runat="server">
                <Listeners>
                    <BeforeEdit Handler="this.oldValues = Ext.net.clone(e.record.data);" />
                </Listeners>
                <DirectEvents>
                    <Edit OnEvent="OnAfterEdit">
                        <ExtraParams>
                            <ext:Parameter Name="old" Value="this.oldValues" Mode="Raw" Encode="true" />
                            <ext:Parameter Name="new" Value="e.record.data" Mode="Raw" Encode="true" />
                        </ExtraParams>
                    </Edit>
                </DirectEvents>
            </ext:RowEditing>
        </Plugins>