ValidateEdit event doesn't fire on Ext rowEditor

482 Views Asked by At

First my code without the stuffs not concerned :

<ext:Window ID="CommentPopUp" runat="server">
    <Content>
        <ext:GridPanel ID="gvComment" runat="server">
            <Plugins>
                <ext:RowEditor runat="server" SaveText="Save" >
                    <Listeners>
                        <CancelEdit Handler="DeleteRow()" />
                        <ValidateEdit Handler="ValidateComment()"/>
                    </Listeners>
                </ext:RowEditor>
            </Plugins>
            <ColumnModel>
                <Columns>
                    <ext:Column ColumnID="CommentDate" Header="Date" Align="Center" DataIndex="CommentDate" />
                    <ext:Column ColumnID="CommentCreator" Header="User" DataIndex="CommentCreator" />
                    <ext:Column ColumnID="Comment" Header="Comment" DataIndex="Comment" Width="282" >
                        <Editor>
                            <ext:TextArea ID="CommmentEditor" runat="server" />                                    
                        </Editor>
                    </ext:Column>
                </Columns> 
            </ColumnModel>
        </ext:GridPanel>
    </Content>
</ext:Window>

My problem is that the ValidateComment() handler on the ValidateEdit listener is never fire when I click on the save button of my rowEditor, whereas the CancelEdit handler works perfectly. I tried also with the Fn instead of Handler and with the ValidateEdit listener directly on the GridPanel but same issues.

Any ideas of what's wrong in this code ?

EDIT

Got it.

When the edit textArea is empty nothing append but when it contains some text ValidateEdit is fired. So new question :

What handler can I use for intercept click on the row editor save button even if the edit field is empty ?

1

There are 1 best solutions below

0
On

Everything works fine with my test case;

code behind;

  protected void Page_Load(object sender, EventArgs e)
        {


            str.DataSource = this.Data;
            str.DataBind();
        }


         private object[] Data
    {
        get
        {
            DateTime now = DateTime.Now;

            return new object[]
            {
                new object[] { "", 0.02, now },
                new object[] { "Alcoa Inc", 29.01, now },
                new object[] { "Altria Group Inc", 83.81,now },
                new object[] { "American Express Company", 52.55, now },
                new object[] { "American International Group, Inc.", 64.13, now }

            };

        }

         }

presentation layer;

<ext:GridPanel ID="gvComment" runat="server">
    <Plugins>
        <ext:RowEditing runat="server" SaveText="Savexx">
            <Listeners>

                <CancelEdit  Handler="alert('bumm delete');">

                </CancelEdit>
                <ValidateEdit Handler="alert('bumm validate');" ></ValidateEdit>
            </Listeners>


        </ext:RowEditing>

    </Plugins>
    <Store>
        <ext:Store runat="server" ID="str">
            <Model>
                <ext:Model runat="server">
                    <Fields>
                        <ext:ModelField Name="Comment"></ext:ModelField>
                        <ext:ModelField Name="CommentCreator"></ext:ModelField>

                        <ext:ModelField Name="CommentDate"></ext:ModelField>

                    </Fields>

                </ext:Model>
            </Model>

        </ext:Store>

    </Store>
    <ColumnModel>
        <Columns>
            <ext:Column ColumnID="CommentDate" runat="server" Header="Date" Align="Center" DataIndex="CommentDate" />
            <ext:Column ColumnID="CommentCreator" runat="server"  Header="User" DataIndex="CommentCreator" />
            <ext:Column ColumnID="Comment" runat="server"  Header="Comment" DataIndex="Comment" Width="282" >
                <Editor>
                    <ext:TextArea ID="CommmentEditor" runat="server" />                                    
                </Editor>
            </ext:Column>
        </Columns> 
    </ColumnModel>
</ext:GridPanel>