Hybrid View

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    8
    Vote Rating
    0
    diet1986 is on a distinguished road

      0  

    Default Unanswered: Editable Grid panel giving type error b is not defined

    Unanswered: Editable Grid panel giving type error b is not defined


    Hi All, i have a Ext 4 js Grid as below.I have implemented editable plugin in it to change the cells values of the grid.


    Code:
    Ext.define('tpsyndev.view.filedatapreview', {
        extend: 'Ext.grid.Panel',
        alias: 'widget.filedatapreview',
        selType: 'cellmodel',
        width:400,
        height:200,
        autoDestroy:true,
        autoScroll:true,
        id : 'fileuploadpreview',
        //enableLocking : true,
        collapsible: true,
                  x: 10,
                  y: 5,
                  columns: [
                            {
                                text: 'Customer Number',
                                flex: 70,
                                dataIndex: 'customerNumber',
                                cls: 'font-weight:bold;color:#04408c',
                                editor: 'textfield'
                            },
                            {
                                text: 'Supplier Number',
                                flex: 70,
                                dataIndex: 'supplierNumber',
                                cls: 'font-weight:bold;color:#04408c',
                                editor: 'textfield'
                            },
                            {
                                text: 'Party1ItemNumber',
                                flex: 70,
                                dataIndex: 'party1ItemNumber',
                                cls: 'font-weight:bold;color:#04408c',
                                editor: 'textfield'
                            },
                            {
                                text: 'Party2ItemNumber',
                                flex: 70,
                                dataIndex: 'party2ItemNumber',
                                cls: 'font-weight:bold;color:#04408c',
                                editor: 'textfield'
                            },
                            {
                                text: 'Item Description',
                                flex: 70,
                                dataIndex: 'itemDescripton',
                                cls: 'font-weight:bold;color:#04408c',
                                editor: 'textfield'
                            },
                            {
                                text: 'Currency',
                                flex: 70,
                                dataIndex: 'currency',
                                cls: 'font-weight:bold;color:#04408c',
                                editor: 'textfield'
                            },
                            {
                                text: 'BaseUOM',
                                flex: 70,
                                dataIndex: 'baseUOM',
                                cls: 'font-weight:bold;color:#04408c',
                                editor: 'textfield'
                            }, 
                             {
                                text: 'Price',
                                flex: 70,
                                dataIndex: 'price',
                                cls: 'font-weight:bold;color:#04408c',
                                editor: 'textfield'
                            },
                            {
                                text: 'StartDate',
                                flex: 70,
                                dataIndex: 'startDate',
                                xtype: 'datecolumn',
                                cls: 'font-weight:bold;color:#04408c',
                                editor: 'textfield'
                            },
                            {
                                text: 'End Date',
                                flex: 70,
                                dataIndex: 'endDate',
                                xtype: 'datecolumn',
                                cls: 'font-weight:bold;color:#04408c',
                                editor: 'textfield'
                            },
                            {
                                text: 'ActiveFlag',
                                flex: 70,
                                dataIndex: 'activeFlag',
                                cls: 'font-weight:bold;color:#04408c',
                                editor: 'textfield'
                            },
                            {
                                text: 'Validation Errors',
                                flex: 70,
                                dataIndex: 'validations',
                                cls: 'font-weight:bold;color:#04408c',
                                editor: 'textfield'
                            }
                            ],
                  collapsible: false,
                  plugins: [
                            Ext.create('Ext.grid.plugin.CellEditing', {
                                clicksToEdit: 1
                            })
                            ],
                  autoScroll: true,
                  title: 'Uploaded Data Preview',
                  columnLines: true,
                  sortableColumns: true,
                 // multiSelect: true,
                  store:'tempPartyRelations',
                  dockedItems: [{
                      xtype: 'pagingtoolbar',
                      dock: 'bottom',
                      layout: {
                          pack: 'left'
                      },
                      items: [
                              { xtype: 'component', flex: 1 },
                              { xtype: 'button', text: 'Submit', width: 80, listeners: {
                                  'click': function() {
                                      var datar = new Array();
                                        var jsonDataEncode = "";
                                        var records = Ext.widget('filedatapreview').getStore().getRange();
                                        for (var i = 0; i < records.length; i++) {
                                            datar.push(records[i].data);
                                        }
                                        jsonDataEncode = Ext.encode(datar);
                                      Ext.Ajax.request({
                                            url: '/tpsyndev/MainLayout/saveTempPartiesDataToMainDomian',
                                            params: {
                                                tempParties: jsonDataEncode
                                            },
                                            success: function(response) {
                                                var text = response.responseText;
                                                // process server response here. For example
                                                alert('Success fully saved');
                                                Ext.getCmp('filedatapreview').getStore().removeAll();
                                                
                                            }
                                          });
                                  }
                              }
                           },{ xtype: 'button', text: 'Validate', width: 80, listeners: {
                                  'click': function() {
                                      var datar = new Array();
                                        var jsonDataEncode = "";
                                        var records = Ext.widget('filedatapreview').getStore().getRange();
                                        for (var i = 0; i < records.length; i++) {
                                            datar.push(records[i].data);
                                        }
                                        jsonDataEncode = Ext.encode(datar);
                                        var k = eval( jsonDataEncode )
                                      Ext.Ajax.request({
                                            url: '/tpsyndev/MainLayout/validateGridData',
                                            params: {
                                                tempParties: jsonDataEncode
                                            },
                                            success: function(response) {
                                                var text = response.responseText;
                                                // process server response here. For example
                                                alert('validation check');
                                                Ext.getCmp('filedatapreview').getStore().load({
                                                    params: {
                                                        runID:k[0].processRunDetailsId,
                                                        type: 'json'
                                                    },
                                                    callback: function(records, operation, success) {
                                                        Ext.getCmp('filedatapreview').getView().refresh();
                                                    },
                                                    scope: this
                                                });
                                            }
                                          });
                                  }
                              }
                           }
                        ]
                  }],
    });
    I am trying to load store and refresh grid on click of validate button and after this when i am trying to change the value of any cell of the grid i am getting type error b is undefined.
    Last edited by diet1986; 5 Nov 2012 at 2:30 AM. Reason: code formatting

  2. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    I'm not sure this will fix your problem. However, below is my suggestion to fix your code of Validate button. It will also applied for the Submit button.
    Code:
        xtype: 'button', 
        text: 'Validate', 
        width: 80, 
        listeners: {
            'click': function() {
                var datar = new Array();
                var jsonDataEncode = "";
                // Ext.widget('filedatapreview') will create a new instance of "filedatapreview", I guess this is not what you want. Instead, you want to refer to current grid that contains this "Validate" button.
                // var records = Ext.widget('filedatapreview').getStore().getRange(); 
                var grid = this.up('filedatapreview'); // get the grid contains this button.
                var store = grid.getStore(); // get store bound to the grid
                var records = store.getRange();
                for (var i = 0; i < records.length; i++) {
    
                    datar.push(records[i].data);
                }
                jsonDataEncode = Ext.encode(datar);
                // var k = eval( jsonDataEncode ) <- no need because k will equivalent to datar
                Ext.Ajax.request({
                    url: '/tpsyndev/MainLayout/validateGridData',
                    params: {
                        tempParties: jsonDataEncode
                    },
                    success: function(response) {
                        var text = response.responseText;
                        // process server response here. For example
                        alert('validation check');
                        // Here I suppose you refer to the same grid. I'm not sure I'm right or not?
                        // Ext.getCmp('filedatapreview').getStore().load({
                        store.load({
                            params: {
    
                                //runID: k[0].processRunDetailsId,
                                runID: datar[0].processRunDetailsId,
                                type: 'json'
    
                            },
                            callback: function(records, operation, success) {
                                // Here I suppose you refer to the same grid. I'm not sure I'm right or not?
                                // Ext.getCmp('filedatapreview').getView().refresh();
                                grid.getView().refresh();
                            },
    
                            scope: this
                        });
                    }
                });
            }
        }
    BTW, you should put your code between CODE tag for readability.

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    8
    Vote Rating
    0
    diet1986 is on a distinguished road

      0  

    Default


    yes you are right

  4. #4
    Sencha User
    Join Date
    Oct 2012
    Posts
    8
    Vote Rating
    0
    diet1986 is on a distinguished road

      0  

    Default


    Thnx Vietits your suggestion work's .You are a genious.Thanx alot
    Quote Originally Posted by vietits View Post
    I'm not sure this will fix your problem. However, below is my suggestion to fix your code of Validate button. It will also applied for the Submit button.
    Code:
        xtype: 'button', 
        text: 'Validate', 
        width: 80, 
        listeners: {
            'click': function() {
                var datar = new Array();
                var jsonDataEncode = "";
                // Ext.widget('filedatapreview') will create a new instance of "filedatapreview", I guess this is not what you want. Instead, you want to refer to current grid that contains this "Validate" button.
                // var records = Ext.widget('filedatapreview').getStore().getRange(); 
                var grid = this.up('filedatapreview'); // get the grid contains this button.
                var store = grid.getStore(); // get store bound to the grid
                var records = store.getRange();
                for (var i = 0; i < records.length; i++) {
    
                    datar.push(records[i].data);
                }
                jsonDataEncode = Ext.encode(datar);
                // var k = eval( jsonDataEncode ) <- no need because k will equivalent to datar
                Ext.Ajax.request({
                    url: '/tpsyndev/MainLayout/validateGridData',
                    params: {
                        tempParties: jsonDataEncode
                    },
                    success: function(response) {
                        var text = response.responseText;
                        // process server response here. For example
                        alert('validation check');
                        // Here I suppose you refer to the same grid. I'm not sure I'm right or not?
                        // Ext.getCmp('filedatapreview').getStore().load({
                        store.load({
                            params: {
    
                                //runID: k[0].processRunDetailsId,
                                runID: datar[0].processRunDetailsId,
                                type: 'json'
    
                            },
                            callback: function(records, operation, success) {
                                // Here I suppose you refer to the same grid. I'm not sure I'm right or not?
                                // Ext.getCmp('filedatapreview').getView().refresh();
                                grid.getView().refresh();
                            },
    
                            scope: this
                        });
                    }
                });
            }
        }
    BTW, you should put your code between CODE tag for readability.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi