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

      0  

    Default CheckColumn in GridPanel with automatic store save

    CheckColumn in GridPanel with automatic store save


    Hi,
    I'm trying to make a Ext.grid.Panel with a CheckBox-Column (Checkcolumn) with automatic save if the checkbox-value changed.
    Code:
    Ext.define('Management.view.MyList', {
        extend: 'Ext.grid.Panel',
        alias: 'widget.mylist',
        store: 'MyStore',
        region: 'west',
        plugins: [
                  Ext.create('Ext.grid.plugin.CellEditing', {
                      clicksToEdit: 1,
                      listeners: {
                    		beforeedit: function(){
                    			alert("beforeedit");
                    		}
                    	}
                  })
              ],
        selType: 'cellmodel',	
        columns: [
                  {
                      text     : 'Name',
                      minWidth : 300,
                      flex	   : true,
                      sortable : true,
                      dataIndex: 'name',
            	  editor: {
                              xtype: 'textfield',
                          }
                  },
                  {
                	  xtype: 'checkcolumn',
                      text     : 'Active?',
                      dataIndex: 'active',
                      width: 80,
                      editor: {
                          xtype: 'checkbox',
                      },
                  },
            
        ],
        title: 'Liste',
    });
    If I edit the name-column the beforeedit (and afterdit) event is fired.
    But if I check (or uncheck) the active-column nothing happend...

    My goal is a grid like this http://dev.sencha.com/deploy/ext-4.0...er/writer.html with automatic save and a checkbox-column.

    Is there a way to do it? Thanks.

  2. #2
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    Hi sTaxxx,

    You need to attached a "change" listeners to checkbox column, like-
    Code:
    {
                      xtype: 'checkcolumn',
                      text     : 'Active?',
                      dataIndex: 'active', 
                     width: 80,
                      editor: {
                         xtype: 'checkbox',
                          listeners:{
                             change:function(this, newValue, oldvalue, eopts){
                                    if(this.checked == true){ 
                                             alert('Save record')
                                     }
                               }
                             }
                      }
                  }
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

Thread Participants: 1