[CLOSED] Pagingtoolbar not visible in form panel when plugin for form is used

  1. #1

    [CLOSED] Pagingtoolbar not visible in form panel when plugin for form is used

    Hey Guys, I have what is probably a small issue related to something I'm doing with the plugin(which is really just an extension) I have, but I have no idea what I am doing improperly or what. My intent is to extend the formpanel for this page to nicely wrap up some function calls related to the form "context" instead of having function xyz() all over the place.

    simple generic plugin
    Ext.ux.AccountForm = function (config) {
    
    
        Ext.apply(this, config);
    }
    Ext.extend(Ext.ux.AccountForm, Ext.FormPanel,
     {
         init: function (panel) {
             Ext.apply(panel, {
                 handleUserEditSuccess: function () {
                     UserDetailsStore.load();
                 },
                 showMask: function (text) {
                     this.getEl().mask(text);
                 },
                 hideMask: function () {
                     this.getEl().unmask();
                 }
             }, this);
         }
     });
     Ext.preg('mvcEditFormExtension', Ext.ux.AccountForm);
    Formpanel
     <ext:FormPanel ID="UserDetailForm" IDMode="Static" Region="West" runat="server" BodyStyle="background-color:#D5E2F2;"
                    Width="400"   Padding="20" Title="Edit Users">
                    <TopBar>
                        <ext:PagingToolbar ID="DPager" StoreID="UserDetailsStore" runat="server" PageSize="1"
                            HideRefresh="true" DisplayInfo="false" IDMode="Static">
                            <Items>
                                <ext:Button ID="UpdateUserButton" runat="server" Icon="Disk">
                                    <DirectEvents>
                                        <Click Url="~/Facility/Edit" Method="POST" Json="false" Success="UserDetailForm.handleUserEditSuccess()" />
                                    </DirectEvents>
                                </ext:Button>
                            </Items>
                        </ext:PagingToolbar>
                    </TopBar>
                    <Items>
                        <ext:Hidden ID="DID" DataIndex="ID" runat="server" />
                        <ext:TextField ID="DFirstName" DataIndex="FirstName" AnchorHorizontal="90%" runat="server"
                            FieldLabel="First Name" IDMode="Static" AllowBlank="false" EmptyText="First Name is required"
                            MsgTarget="Under">
                        </ext:TextField>
                        <ext:TextField ID="DLastName" DataIndex="LastName" runat="server" AnchorHorizontal="90%"
                            FieldLabel="Last Name" IDMode="Static" AllowBlank="false" EmptyText="Last Name is required"
                            MsgTarget="Under">
                        </ext:TextField>
                        <ext:TextField ID="DUserName" DataIndex="UserName" runat="server" AnchorHorizontal="90%"
                            FieldLabel="User Name" IDMode="Static" AllowBlank="false" ValidateOnBlur="true"
                            MsgTarget="Under" EmptyText="User name is required">
                        </ext:TextField>
                        <ext:TextField ID="DEmail" DataIndex="Email" runat="server" AnchorHorizontal="90%"
                            FieldLabel="Email" IDMode="Static" Vtype="email" AllowBlank="false" ValidateOnBlur="true"
                            MsgTarget="Under" EmptyText="Email is required">
                        </ext:TextField>
                        <ext:Checkbox ID="DEnabled" DataIndex="Enabled" runat="server" AnchorHorizontal="90%"
                            FieldLabel="Enabled" IDMode="Static" />
                        <ext:MultiCombo ID="DRoles" IDMode="Static" DataIndex="Roles" runat="server" AnchorHorizontal="90%"
                            ListEmptyText="No Roles Found" ValueField="ID" DisplayField="RoleName" FieldLabel="Roles"
                            Editable="false" LoadingText="Loading Role Data" SelectionMode="Selection" AlwaysMergeItems="true"
                            StoreID="RolesStore">
                        </ext:MultiCombo>
                    </Items>
                    <Plugins>
                        <ext:GenericPlugin runat="server" InstanceName="Ext.ux.AccountForm" />
                    </Plugins>
                </ext:FormPanel>
    I KNOW it's the plugin or something to do with it, because as soon as I remove it, the paging toolbar renders. ADDITIONALLY, the paging OBJECT is created as I can see it in firebug.. it just doesn't render. So what am I doing wrong with the plugin that it will not show the toolbar?

    Thanks!

    [EDIT]

    I just noticed this error in the JS Console in chrome:


    Last edited by Daniil; May 11, 2012 at 4:56 PM. Reason: [CLOSED]
  2. #2
    Hi,

    I think the problem lies here:
    init: function (panel) {
        Ext.apply(panel, {
            handleUserEditSuccess: function () {
                UserDetailsStore.load();
            },
            showMask: function (text) {
                this.getEl().mask(text);
            },
            hideMask: function () {
                this.getEl().unmask();
            }
        }, this);
    }
    There is ", this" at the end. I'm not sure what you mean, but I would remove it. It erases the properties of the "panel" instance.
  3. #3
    Ahhh.. you're right.. actually, I had to replace the scope with the panel object and the problem was solved. I can't believe I didn't notice that before. I kept staring at it and staring at it.. sometimes it just takes another set of eyes.

    the fix:
    Ext.extend(Ext.ux.AccountForm, Ext.FormPanel,
     {
         init: function (panel) {
             Ext.apply(panel, {
                 handleUserEditSuccess: function () {
                     UserDetailsStore.load();
                 },
                 showMask: function (text) {
                     this.getEl().mask(text);
                 },
                 hideMask: function () {
                     this.getEl().unmask();
                 }
             },panel); //use panel as scope
         }
     });
  4. #4
    I understand you, I spent several hours in a similar situation today :) A launch break helped me:)

    Could you clarify what "scope" do you mean in the context of the Ext.apply function?

    Seems you could just remove the third parameter.
    http://docs.sencha.com/ext-js/3-4/#!...t-method-apply
  5. #5
    Indeed. and now I've learned something new today. Still learning all the nuances of the framework. Thanks for the link!
  6. #6
    I am still learning as well :)

Similar Threads

  1. [CLOSED] Is it possible to control child form controls from main form?
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 13, 2012, 12:24 PM
  2. Replies: 2
    Last Post: Aug 29, 2011, 3:53 PM
  3. Replies: 1
    Last Post: Aug 02, 2011, 12:59 PM
  4. [CLOSED] Red circle is not visible in form validation with fieldset
    By 78fede78 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 13, 2010, 2:14 PM
  5. Replies: 1
    Last Post: Apr 15, 2009, 3:35 PM

Posting Permissions