Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Location
    Clearwater, FL
    Posts
    10
    Vote Rating
    0
    BadISBrad is on a distinguished road

      0  

    Default Answered: Re-use store in different window instances?

    Answered: Re-use store in different window instances?


    I'm trying to replicate the UI functionality of a Delphi software in a web app, I'm fairly new the ExtJs but no JS. Im having trouble understanding the proper way of separating my views and data. For example I have a main window instance for my app, when a user double clicks a record for a grid, I want to instantiate a new instance of the "Edit" class that I had already created in Architect. I have a store, model defined for the grid. So my question is would it be best practice to update the already existing store/model instance using the models index in the store? I'm using a controller to listen for the 'itemdblclick' event, which also passes a model instance of the record selected along with index. What would be the best practice here?

    Also I've build a simple asp page to output a dynamic xml file on demand, I want to build in update functionality to it but I'm not sure where I would start to even try to update from ExtJs as far as store/models are concerned. Can anyone suggest some good examples of updating data to a server side resource, all if the asp is just for testing. We have a third party JSON connector for our database called RemOjbects that we will be converting all of the data objects to use. Any help would be appreciated while I am still evaluating Sencha as a solution for my company...

  2. If I understand what you are looking for this example pretty much does it:
    http://docs.sencha.com/ext-js/4-1/#!/example/form/form-grid.html

    Only thing it is missing is a save button on the form which would pretty much call:
    http://docs.sencha.com/ext-js/4-1/#!...d-updateRecord
    Which you'd probably want to follow up with a:
    http://docs.sencha.com/ext-js/4-1/#!...re-method-sync

  3. #2
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    St Louis,MO
    Posts
    267
    Answers
    20
    Vote Rating
    18
    James Goddard will become famous soon enough James Goddard will become famous soon enough

      1  

    Default


    If I understand what you are looking for this example pretty much does it:
    http://docs.sencha.com/ext-js/4-1/#!/example/form/form-grid.html

    Only thing it is missing is a save button on the form which would pretty much call:
    http://docs.sencha.com/ext-js/4-1/#!...d-updateRecord
    Which you'd probably want to follow up with a:
    http://docs.sencha.com/ext-js/4-1/#!...re-method-sync

  4. #3
    Sencha User
    Join Date
    Oct 2012
    Location
    Clearwater, FL
    Posts
    10
    Vote Rating
    0
    BadISBrad is on a distinguished road

      0  

    Default


    Thank you for your reply, I did find the solution to one of my questions with the form example.

    I'm curious though, in the update example you gave. It says that the method will update the (model) passed to it, which is what I need if that means it will update the model instance in the originating store which is connected to the originating grid panel. So in other words, the same store from which the model instance came, is the same model instance that I want to update. Does that make sense? Because when I go to call (MyProxy.MyWriter) to send updates to wherever, I need the changes to actually be made in the store first...right?

  5. #4
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    St Louis,MO
    Posts
    267
    Answers
    20
    Vote Rating
    18
    James Goddard will become famous soon enough James Goddard will become famous soon enough

      0  

    Default


    As long as the record you passed in to loadRecord or updateRecord is the record from the store, then yes, it will update that record.

  6. #5
    Sencha User
    Join Date
    Oct 2012
    Location
    Clearwater, FL
    Posts
    10
    Vote Rating
    0
    BadISBrad is on a distinguished road

      0  

    Default


    Ok, I tried to update the same record by not specifying a record in updateRecord(), which is supposed to update the same record as passed to loadRecord() and this is what I get.


    Uncaught ReferenceError: record is not defined Edit.js:89
    Ext.define.onBtnSaveClick Edit.js:89
    fire ext-all.js:15
    Ext.define.continueFireEvent ext-all.js:15
    Ext.define.fireEvent ext-all.js:15
    Ext.override.fireEvent ext-all.js:15
    Ext.define.fireHandler ext-all.js:15
    Ext.define.onClick ext-all.js:15
    (anonymous function)
    c


    This is the code I was using for my edit screen...

    Code:
    Ext.define('Inters.view.Edit', {
        extend: 'Ext.window.Window',
    
    
        height: 502,
        id: 'wEdit',
        width: 752,
        title: 'Edit',
        modal: true,
    
    
        initComponent: function() {
            var me = this;
    
    
            Ext.applyIf(me, {
                dockedItems: [
                    {
                        xtype: 'tabpanel',
                        dock: 'top',
                        height: 472,
                        activeTab: 0,
                        dockedItems: [
                            {
                                xtype: 'form',
                                dock: 'top',
                                height: 427,
                                id: 'Overview',
                                layout: {
                                    type: 'absolute'
                                },
                                bodyPadding: 10,
                                title: 'Overview',
                                items: [
                                    {
                                        xtype: 'textfield',
                                        id: 'frmFirstName',
                                        width: 260,
                                        name: 'firstname',
                                        fieldLabel: 'First name'
                                    },
                                    {
                                        xtype: 'textfield',
                                        x: 10,
                                        y: 50,
                                        id: 'frmLastName',
                                        width: 260,
                                        name: 'lastname',
                                        fieldLabel: 'Last name'
                                    },
                                    {
                                        xtype: 'button',
                                        x: 297,
                                        y: 255,
                                        id: 'btnSave',
                                        text: 'Save',
                                        listeners: {
                                            click: {
                                                fn: me.onBtnSaveClick,
                                                scope: me
                                            }
                                        }
                                    }
                                ]
                            }
                        ]
                    }
                ]
            });
    
    
            me.callParent(arguments);
        },
    
    
        onBtnSaveClick: function(button, e, options) {
    
    
    
    
            button.up('form').getForm().updateRecord();
        }
    
    
    });

  7. #6
    Sencha User
    Join Date
    Oct 2012
    Location
    Clearwater, FL
    Posts
    10
    Vote Rating
    0
    BadISBrad is on a distinguished road

      0  

    Default


    This is the controller event that fires the loadRecord()

    Code:
    Ext.define('Inters.controller.IntersController', {    extend: 'Ext.app.Controller',
    
    
        views: [
            'Inters'
        ],
    
    
        onGridviewItemDblClick: function(tablepanel, record, item, index, e, options) {
    
    
    
    
            // console.log(record.get('studentid'));
    
    
    
    
            var x = Ext.create('Inters.view.Edit');
    
    
            Ext.getCmp('Overview').loadRecord(record);
    
    
            x.show();
        },
    
    
        init: function(application) {
            this.control({
                "gridpanel": {
                    itemdblclick: this.onGridviewItemDblClick
                }
            });
        }
    
    
    });

  8. #7
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    St Louis,MO
    Posts
    267
    Answers
    20
    Vote Rating
    18
    James Goddard will become famous soon enough James Goddard will become famous soon enough

      0  

    Default


    Should work, loadRecord sets this._record and updateRecord uses it. Might want to debug and check out the this and make sure they are the same and see what _record is set to.

    You could also just save the record yourself and pass it to the update.

  9. #8
    Sencha User
    Join Date
    Oct 2012
    Location
    Clearwater, FL
    Posts
    10
    Vote Rating
    0
    BadISBrad is on a distinguished road

      0  

    Default


    Ok, this is for anyone else that reads this thread and missed the important comment in the documentation like I did. You must first get the form instance

    Code:
    var basicForm= button.up('form').getForm();
    then get the record instance of the form
    Code:
    var rec = basicForm.getRecord();
    then explicitly set the model instance in the update like so
    Code:
    basicForm = basicForm.updateRecord(rec);
    this is in the documentation comments for Ext.form.Basic located here...

    http://docs-devel.sencha.com/ext-js/...d-updateRecord

Thread Participants: 1

Tags for this Thread