form.getRecord() is undefind. Extjs

In my application I use the Ext.form.Panel component. In the panel set the selected entry from the tree using loadRecord(record)

...
showDataFields: function(view, record, item, index, event) {       
        var panel = view.up('tabpanel');
        var formfield   = panel.down('form');        
        formfield.loadRecord(record);
    },

....

I get an entry to send data to the store

...

saveUserData: function(button, e) {
        var values;
        var panel    = button.up('actionform'),
            form   = panel.down('form');
        record = form.getRecord();
        console.log(record)// value undefined. Why ?      
    },

...

How to get a record?

Link to my fiddle app the form is in the file app/view/ActionFormTree.js

The showDataFields and saveUserData methods are in app/controller/MainController.js

thank

As you are getting your form component using button.up('actionform') and then after again you are using panel.down('form'). So in this case you getting inner form of form component. See below screenshot for better understanding (see selected dom element)

So you don't need to use down selector because you already getting form component using button.up('actionform').

Code Snippet

saveUserData: function(button, e) {

    var values, form = button.up('actionform'),
        record = form.getRecord();

    console.log(record)
},

You can check here with working fiddle.

ExtJS 4 MVC Application: Form undefined error, getForm(), // get the basic form record = form.getRecord(); // get the underlying model instance if (form.isValid()) { // make sure the form contains  form.getRecord() is undefind. Extjs. Ask Question Asked 1 year, 5 months ago. Active 1 year, 5 months ago. Viewed 166 times 0. In my

If I understand your design correctly, what I think is the problem is how you reference your form.

saveUserData: function(button, e) {

    var values;
    var panel  = button.up('tabpanel'),
        form   = panel.down('form');
    // Or, because button is on your form:
    // var form = button.up('form');

    record = form.getRecord();
    console.log(record)// value undefined. Why ?

    //store = this.getUserTreeStoreStore('UserTreeStore');
    //values = form.getValues();
    //id = form.getRecord().get('id');

},

Forms, var user = Ext.create('User', { id : 'ABCD12345', name : 'Conan', age : 24, phone: from the "validation" of a record to the form fields that may be bound to its values. //Uses the configured RestProxy to make a GET request to /users/123 If the passed record is undefined, does nothing. Class.method1 = function() { . Ext JS Classic - API documentation from Sencha. Forms. A Form Panel is nothing more than a basic Panel with form handling abilities added. Form Panels can be used throughout an Ext application wherever there is a need to collect data from the user.

better is to assign the itemId property to your form panel and use getValues() function

var formpanel = Ext.ComponentQuery.query('form[itemId=your_form_itemId_here]')[0];
var form = formpanel.getForm();//this gets all the fields inside the form 
//no to fetch the record or form field values
var record = form.getValues();

this is Convenient function for fetching the current values of each field in the form. ...

Ext.data.Model, AjaxBaseForm //Uses the configured RestProxy to make a GET request to /​users/123 User.load(123, By default, the model ID is specified in an HTTP parameter named id . If the passed record is undefined, does nothing. Note that unlike Ext.Base#self, this.statics() is scope-independent and it always returns the  Ext JS is the best JavaScript framework in the world, professionally supported and maintained with world-class components.

Ext.data.Model, If you add records ot a store like this: grid.store.add(new Ext.data.Record({ id: entries.id, text: entries.text, tableUid: entries. its a problem with changes on ExtJS, not Ext.NET) since several months. <body> <form runat="server"> <ext:​ResourceManager runat="server" getRowsValues() but I'm not sure. DOM events from Ext JS Ext.Component While some Ext JS Component classes export selected DOM events (e.g. "click", "mouseover" etc), this is usually only done when extra value can be added. For example the DataView 's itemclick event passing the node clicked on.

[CLOSED] record.fields is undefined after store.add(new Ext.Record , Record objects which provide input data for widgets such as the Ext.grid.Grid, or the DataProxy to access a data object unless you call loadData() directly and pass in your data. The Store Get the index within the cache of the Record with the passed id. (optional) Pass true to allow null, undefined or empty string values. Tag: forms,extjs,model-view-controller,master-slave. I'm using Extjs5.1 powered by a MVC oriented code style. I've got a main view which inherits from Ext.panel.Panel with a border layout. On the east region, there's a grid with a store containing several records (or "models", I don't really know what terminology I should use here). (the

Ext.data.Store, ArrayReader( { idIndex: 0 // id for each record will be the first element }, rt While some ExtJs Component classes export selected DOM events (e.g. "click", c) { return function(e) { fn.call(this, e, c); }; } }); var combo = new Ext.form. The store will automatically generate GET, POST, PUT and DELETE requests to the server.

Comments
  • Thank you, your answer works for me. Why is it necessary to go up to the tabpanel?
  • @Ambasador You dont need to go up to 'tabpanel in this case. Your button is on your form, so I think that var form = button.up('actionform'); will be enough in this case.