1. #1
    Sencha User
    Join Date
    Sep 2008
    Posts
    16
    Vote Rating
    0
    aborjinos is on a distinguished road

      0  

    Default Form Submit Problem

    Form Submit Problem


    Hello everybody,

    I tried to use Layouts but I took some errors. When I clicked the submit button Output says "this.form is null or not an object" so how can I submit my form? I think xtype : 'form' is the source of these errors because I cant use users_add as Ext.form.FormPanel source?

    Is anybody know How can I fix this problem?

    Code:
    var users_add = {
     xtype: 'form',
     id: 'users_add-panel',
        labelWidth: 75,
        title: 'Add New User',
        bodyStyle:'padding:15px',
        width: 350,
     labelPad: 20,
     layoutConfig: {
      labelSeparator: ''
     },
        defaults: {
      width: 230,
      msgTarget: 'side'
     },
        defaultType: 'textfield',
     items: [{
      fieldLabel: 'User Name',    //label text
      name: 'data[User][username]',   //field name for submit purposes
      allowBlank: false      //simple validation
     },
     {
      fieldLabel: 'Full Name',
      name: 'data[User][fullname]',
      allowBlank: false
     }],
     buttons: [{
      text: 'Save',  //text for submit button
      type: 'submit',  //type for button
      handler: function() { //what happens when I click the button?
       this.form.submit({
        url: 'http://' + host + 'users/add2',
        success: function() {
         Ext.MessageBox.alert('Message', 'It worked!');
        },
        failure: function() {
         Ext.MessageBox.alert('Message', 'Save failed!');
        }
       });
      }
     },
     {
      text: 'Cancel',
      handler: function() {
       this.form.reset();
      }
     }]
    };

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    'this' will refer to the button (because you didn't specify a scope), so your code won't work.

    Instead use:
    Code:
    Ext.getCmp('users_add-panel').getForm().submit({

  3. #3
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    5
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    Looks like a scope problem. Check what the scope is for "this" inside your handler.


    ....I'm too slow.

  4. #4
    Sencha User
    Join Date
    Sep 2008
    Posts
    16
    Vote Rating
    0
    aborjinos is on a distinguished road

      0  

    Default


    So many thanks for your quick reply! it works very fine.

    I want to ask one more question

    When I want to use grid in my layout I take "root is undefined" error. Everything works fine until
    Code:
    store.loadData({params:{start:0, limit:10}});
    line. After this line error will occur.
    When I remove this line everything works fine without user informations then if I click the refresh button on the grid data will fetch from the server. I can see user informations on the grid.

    I want to see user informations when the grid is rendered. So where is my mistake?

    PHP Code:
    var store = new Ext.data.Store({
        
    proxy: new Ext.data.HttpProxy({url'http://' host 'users/getAllUsers'}),  //note that I used host in the url
        
    reader: new Ext.data.JsonReader({
        
    root'users',
     
    totalProperty'total',
     
    id'id',
     
    fields: [
      {
    name'id'},
      {
    name'username'},
      {
    name'fullname'}
     ]
     })
    });
    var 
    users_list = {
     
    id'users_list-panel',
     
    title'Users List',
        
    layout:'fit',
        
    bodyStyle'padding:5px',
        
    items: [{
      
    xtype'grid',
      
    layout'fit',
      
    height350,
      
    width350,
            
    storestore,
      
    columns: [
       {
    id:'id',header"ID"width50sortabletruedataIndex'id'},
       {
    header"Username"width125sortabletruedataIndex'username'},
       {
    header"Full name"width125sortabletruedataIndex'fullname'}
      ],
      
    cm: new Ext.grid.ColumnModel([
             {
    header"ID"dataIndex'id'width100},
       {
    header"User Name"dataIndex'username'width100},
       {
    header"Full Name"dataIndex'fullname'width100}
         ]),
      
    stripeRowstrue,
      
    bbar: new Ext.PagingToolbar({
       
    pageSize10,
       
    storestore,
       
    displayInfotrue,
       
    displayMsg'Displaying {0} - {1} of {2}',
       
    emptyMsg'No users to display'
      
    }),
      
    // Add a listener to load the data only after the grid is rendered:
            
    listeners: {
             
    render: function(){
              
    //store.loadData({params:{start:0, limit:10}});
             
    }
            }
     }]
    }; 

  5. #5
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    Please read the API docs on Store.load and Store.loadData.

    You want:
    Code:
    store.load({params:{start:0, limit:10}});

  6. #6
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    5
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    store.loadData() is for local data. use store.load() for remote data.

  7. #7
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    5
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    Edit............what am I in delay mode over here?

  8. #8
    Sencha User
    Join Date
    Sep 2008
    Posts
    16
    Vote Rating
    0
    aborjinos is on a distinguished road

      0  

    Default


    Hey boys you are very marvellous indeed.

    So many thanks...

    Could you give me some advise to learn Ext Js ( with CakePhp will be good)
    Where I have to start, Which web site? I know first google and I am examining examples on the web now but may be tutorials with commnets or e-books will be good for new learners just like me.

    Thanks again for your helps...

  9. #9
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    5
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    I'm reluctant to reply since someone will beat me.

    Don't fret the backend. ExtJS plays with any of them, barring some nuances. Basically you just need to know how to transmit JSON or XML between client and backend.

    If I'm looking to learn something new I might go about it this way:
    1. See if there's something in the demos that is close
    2. Review the demo source code.
    3. If I see commands in the source and don't understand what it's doing check the API Docs for more info
    4. Kind of simultaneously with the first item, see if there's a tutorial for what you're about to do that might provide additional commentary.
    5. Check the http://extjs.com/learn/Ext_FAQ FAQs if you encounter any problems along the way for the part you're working on.
    6. If you're branching into something more complex, then check the tutorial section for "application design" stuff (how to structure your app, working with scope, extending, xtypes, etc).
    7. Also if you're branching out check the extensions to see if someone has done something similar. There is a forum for extensions, as well as a recent initiative to house extensions in a more centralized, searchable location (see my signature).
    8. Wait for a book (rumor has it there are at least 2 in the works, but don't expect these for some time).
    9. Also check backend forums. CodeIgniter for example has some information on integration in their forums.
    10. Finally feel free to contribute your learning experience to a tutorial or supplement the FAQs. Don't worry about posting something wrong, someone will correct it.

  10. #10
    Sencha User
    Join Date
    Sep 2008
    Posts
    16
    Vote Rating
    0
    aborjinos is on a distinguished road

      0  

    Default


    @mjlecomte

    so many thanks for your roadmap...

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar