1. #1
    Sencha User
    Join Date
    Jul 2008
    Posts
    33
    Vote Rating
    0
    muratyildiz is on a distinguished road

      0  

    Default Custom GridPanel restFull store problem

    Custom GridPanel restFull store problem


    I have a custom grid for restfull store. I want to edit record on custom grid like ext restfull store example. But not shown column editor's. There is no problem on datastore. Can you help me?
    Plugin:
    Code:
    Ext.ns('JEStudio');
    JEStudio.GridPanel = Ext.extend(Ext.grid.GridPanel, {
        border : false,
        url : null,
        groupView : false,
        groupField : null,
        autoHeight : true,
        loadMethod : 'list',
        updateMethod : 'update',
        deleteMethod : 'delete',
        showPagingToolbar : true,
        autoScroll: true,
        userForm : null,
        clicksToEdit: 1,
        editable : false,
        editor : null,
        initComponent : function(config) {
            var config = config||{};
            this.buildConfig(config);
            config.tbar = [{
                text: 'Yeni Kayıt',
                iconCls: 'silk-add',
                handler: this.onAdd,
                scope: this
            }, '-', {
                text: 'Sil',
                iconCls: 'silk-delete',
                handler: this.onDelete,
                scope: this
            }, '-',
            {
                text: 'Kaydet',
                iconCls: 'silk-save',
                handler: this.onSave,
                scope: this
            }, '-'];        
            if (this.editable) {
                this.plugins = [new Ext.ux.RowEditor()];
            }
            // apply config
            Ext.apply(this, Ext.apply(this.initialConfig, config));
            JEStudio.GridPanel.superclass.initComponent.apply(this, arguments);
        } // eo function initComponent
        ,
        buildConfig : function(config) {
            this.buildColumns(config);
            this.buildPlugins(config);
            this.buildTbar(config);
            this.buildBbar(config);
            //
        } // eo function buildConfig
        ,
        buildColumns : function(config) {
            config.columns = undefined;
        } // eo function buildColumns
        ,
        getReaderFields : function() {
            var flds = [];
            var columns = this.getColumnModel().getColumnsBy(function(c) {
                if (c.mapping) {
                    flds[flds.length] = {
                        name : c.dataIndex,
                        mapping : c.dataIndex
                    };
                }
            });
            return flds;
        },
        rowclick : function(g, index, ev) {
            if (this.userForm) {
                var rec = this.store.getAt(index);
                Ext.getCmp(this.userForm).getForm().loadRecord(rec);
            }
        },// eo function rowClick
        buildPlugins : function(config) {
            config.plugins = undefined;
        } // eo function buildPlugins
        ,
        buildTbar : function(config) {
            config.tbar = undefined;        
        } // eo function buildTbar
        ,
        buildBbar : function(config) {
            config.bbar = undefined;
    
        }, // eo function buildBbar
        onAdd : function(btn, ev) {
            var u = new this.store.recordType();
            this.stopEditing();
            this.store.insert(0, u);
            this.startEditing(0, 1);
        },//eo function onAdd
        onSave : function(btn, ev) {
            
            this.store.save();
        }, //eo function onSave
        
        onDelete : function(btn, ev) {
            var self = this;
            var selected_rows = self.getSelectionModel().getSelections();
            if(selected_rows.length > 0) {                                        
                var id = '';
                var i = 0;
                for(i=0; i<selected_rows.length; i++) {
                    id += selected_rows[i].get(self.store.idProperty);
                    if(i < (selected_rows.length - 1)) {
                        id += ',';
                    }
                }
                //alert(id);
    
                Ext.MessageBox.confirm('Dikkat', 'Seçili kayıt veya kayıtlar silinecektir. Emin misiniz?', function (btn, text) {
                    if (btn=='yes') {
                        //alert(self.url+'!'+self.deleteMethod);
                        Ext.Ajax.request({
                            url : self.url+'!'+self.deleteMethod,
                            params : {
                                id: id
                            },
                            method: 'POST',
                            success: function (results, request ) {
                                //Ext.MessageBox.hide();    
                                //self.getStore().reload();
                                var i = 0;
                                for(i=0; i<selected_rows.length; i++) {
                                        self.store.remove(selected_rows[i]);                                }
                                }
                        });
                    }
                });
    
            } else {
                Ext.MessageBox.alert('Uyarı', 'Silmek için herhangi bir kayıt seçilmemiş. Silmek için listeden kayıt veya kayıtları(CTRL basılı tutarak) öncelikle seçmelisiniz.');
            }
        },//eo function onDelete
        onRender : function() {
            if (this.autoLoad)
                this.store.load();
            JEStudio.GridPanel.superclass.onRender.apply(this, arguments);
    
        } // eo function onRender
        ,
        loadexception : function(obj, options, response, e) {
            var errors = Ext.decode(response.responseText);
            Ext.jes.showErrorsStore(errors);
        }// eo function loadexception
        ,
        load : function() {
            this.load();
        }// eo function load
    });
    
    Ext.reg('jesgrid', JEStudio.GridPanel);
    Sample Code : not work

    Code:
    var grid = new JEStudio.GridPanel({
        url : '/jestudio/yetki/LogAction',
        autoLoad : false,
        store : storeR,
        userForm :'nameForm',  
        autoHeight:false,
        height : 400,
        editable : true,
        buildColumns:function(cfg) {
            cfg.columns = [
                { header: 'Firt Name',dataIndex:'firstName',width:150, editor: new Ext.form.TextField({})},
                { header: 'Last Name',dataIndex:'lastName',width:150},
                { header: 'Mid Name',dataIndex:'middleName',width:150, editor: new Ext.form.TextField({})},
                { header: 'Date',dataIndex:'dob',width:150,type:'date',format:'d/m/Y',editor: new Ext.form.DateField({format:'d/m/Y'})}
                ];    
        }
        ,buildBbar:function(cfg) {
            cfg.bbar = [new JEStudio.PagingToolbar({store:storeR,pageSize :20})];
        }
    });
    This code is work.(same datastore)
    Code:
    var grid4 = new Ext.grid.GridPanel({
        url : '/jestudio/yetki/LogAction',
        autoLoad : false,
        store : storeR,
        autoHeight:false,
        height : 400,
        columns : [
                { header: 'Firt Name',dataIndex:'firstName',width:150, editor: new Ext.form.TextField({})},
                { header: 'Last Name',dataIndex:'lastName',width:150},
                { header: 'Mid Name',dataIndex:'middleName',width:150, editor: new Ext.form.TextField({})},
                { header: 'Date',dataIndex:'dob',width:150,type:'date',format:'d/m/Y',editor: new Ext.form.DateField({format:'d/m/Y'})}
                ],
        bbar : [new JEStudio.PagingToolbar({store:storeR,pageSize :20})],
        plugins :[editor1]
    });

  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


    I don't see a buildPlugins method that sets this.plugins to [editor1]...

  3. #3
    Sencha User
    Join Date
    Jul 2008
    Posts
    33
    Vote Rating
    0
    muratyildiz is on a distinguished road

      0  

    Default


    on custom grid init :

    Code:
    ....
            if (this.editable) {             
              this.plugins = [new Ext.ux.RowEditor()];         
             } 
    ....

  4. #4
    Sencha User
    Join Date
    Jul 2008
    Posts
    33
    Vote Rating
    0
    muratyildiz is on a distinguished road

      0  

    Default


    Thanks. Problem solved. Plugins problem . Your are right. I added buildPlugins method then work.
    Code:
    var grid = new JEStudio.GridPanel({
        url : '/jestudio/yetki/LogAction',
        autoLoad : false,
        store : storeR,
        userForm :'nameForm',  
        autoHeight:false,
        height : 400,
        editable : true,
        buildColumns:function(cfg) {
            cfg.columns = [
                { header: 'Firt Name',dataIndex:'firstName',width:150, editor: new Ext.form.TextField({})},
                { header: 'Last Name',dataIndex:'lastName',width:150},
                { header: 'Mid Name',dataIndex:'middleName',width:150, editor: new Ext.form.TextField({})},
                { header: 'Date',dataIndex:'dob',width:150,type:'date',format:'d/m/Y',editor: new Ext.form.DateField({format:'d/m/Y'})}
                ];    
        }
        ,buildBbar:function(cfg) {
            cfg.bbar = [new JEStudio.PagingToolbar({store:storeR,pageSize :20}),'-','->','Deneme'];
        }
        ,buildPlugins:function(cfg) {
            cfg.plugins = [new JEStudio.RowEditor()];
        }
    });

Similar Threads

  1. Restfull
    By alien3d in forum Community Discussion
    Replies: 2
    Last Post: 29 Jun 2010, 7:07 PM
  2. exception in restfull
    By alien3d in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 27 Jun 2010, 9:56 PM
  3. Problem with GridPanel and RowEditor with a restful Store
    By borillo in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 22 May 2010, 8:19 AM
  4. Tab Panel Store Problem with gridPanel...
    By ilker in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 23 Sep 2008, 2:15 PM
  5. Dynamic Load of GridPanel with internal Store Problem
    By bab5139 in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 29 May 2008, 6:42 PM

Thread Participants: 1

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