Question

I have a grid with actioncolumn. On click of actioncolun it shows a menu with edit and delete items. When i click on Edit it should display a modal-popup window with form panel. The row data should be displayed in fields. I'm able to achieve the above thing by using loadRecord method.

The code i'm using is

actioncolumn.on('click', function (grid, td, rowIndex, eve, e) {
                            var rec = grid.getStore().getAt(rowIndex);
                            if (!this.menu) {
                                this.menu = Ext.create('Ext.menu.Menu', {
                                    width: 100,
                                    height: 70,
                                    plain: true,
                                    floating: true,
                                    items: [{
                                        text: 'Edit',
                                        icon: 'images/Edit.png',
                                        handler: function (a, b, c, d) {
                                            var view = Ext.widget('userwindow');
                                            view.down('baseform').loadRecord(rec);
                                        }
                                    }

}

But the problem is when i'm clicking on edit for second time form panel is displaying the data which is loaded for first time.

Can anybody help

Thanx in advance

Was it helpful?

Solution

I achieved the above by setting the record into a separate variable like

actioncolumn.on('click', function (grid, td, rowIndex, eve, e) {
                           actioncolumn.rec = grid.getStore().getAt(rowIndex);
                            if (!this.menu) {
                                this.menu = Ext.create('Ext.menu.Menu', {
                                    width: 100,
                                    height: 70,
                                    plain: true,
                                    floating: true,
                                    items: [{
                                        text: 'Edit',
                                        icon: 'images/Edit.png',
                                        handler: function (a, b, c, d) {
                                            var view = Ext.widget('userwindow');
                                            view.down('baseform').loadRecord(actioncolumn.rec);
                                        }
                                    }

Regards Url

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top