Results 1 to 5 of 5

Thread: How to add checkcolumn control to toolbox

  1. #1
    Sencha Premium Member
    Join Date
    Feb 2013
    Location
    Bangalore, India
    Posts
    68

    Default How to add checkcolumn control to toolbox

    I have a grid, Within grid i want to add a checkColumn.
    I am doing like this.
    I have a javascript file, Within this i have written the following code for checkColumn.

    Code:
    Ext.define('Ext.ux.CheckColumn', {
        extend: 'Ext.grid.column.Column',
        alias: 'widget.checkcolumn',
    
        stopSelection: true,
        align: 'center',
    
        constructor: function() {
            this.addEvents(
            );
            this.callParent(arguments);
        },
    
        processEvent: function(type, view, cell, recordIndex, cellIndex, e, record, row) {
            var me = this,
                key = type === 'keydown' && e.getKey(),
                mousedown = type == 'mousedown';
    
            if (mousedown || (key == e.ENTER || key == e.SPACE)) {
                var dataIndex = me.dataIndex,
                    checked = !record.get(dataIndex);
    
                if (me.fireEvent('beforecheckchange', me, recordIndex, checked) !== false) {
                    record.set(dataIndex, checked);
                    me.fireEvent('checkchange', me, recordIndex, checked);
    
                    if (mousedown) {
                        e.stopEvent();
                    }
    
                    if (!me.stopSelection) {
                        view.selModel.selectByPosition({
                            row: recordIndex,
                            column: cellIndex
                        });
                    }
    
                    return false;
                } else {
                    return !me.stopSelection;
                }
            } else {
                return me.callParent(arguments);
            }
        },
    
    });
    How can i add this to sencha Architect toolbox as control. So i can use for grid. Is there any example?
    Can you please someone tell me how to do this?

    If anyone have done similar kind of work. please help me.

    Thanks in advance.

  2. #2
    Sencha User
    Join Date
    Jan 2009
    Location
    Frederick, Maryland
    Posts
    925

    Default

    Quote Originally Posted by [email protected] View Post
    I have a grid, Within grid i want to add a checkColumn.
    I am doing like this.
    I have a javascript file, Within this i have written the following code for checkColumn.

    Code:
    Ext.define('Ext.ux.CheckColumn', {
        extend: 'Ext.grid.column.Column',
        alias: 'widget.checkcolumn',
    
        stopSelection: true,
        align: 'center',
    
        constructor: function() {
            this.addEvents(
            );
            this.callParent(arguments);
        },
    
        processEvent: function(type, view, cell, recordIndex, cellIndex, e, record, row) {
            var me = this,
                key = type === 'keydown' && e.getKey(),
                mousedown = type == 'mousedown';
    
            if (mousedown || (key == e.ENTER || key == e.SPACE)) {
                var dataIndex = me.dataIndex,
                    checked = !record.get(dataIndex);
    
                if (me.fireEvent('beforecheckchange', me, recordIndex, checked) !== false) {
                    record.set(dataIndex, checked);
                    me.fireEvent('checkchange', me, recordIndex, checked);
    
                    if (mousedown) {
                        e.stopEvent();
                    }
    
                    if (!me.stopSelection) {
                        view.selModel.selectByPosition({
                            row: recordIndex,
                            column: cellIndex
                        });
                    }
    
                    return false;
                } else {
                    return !me.stopSelection;
                }
            } else {
                return me.callParent(arguments);
            }
        },
    
    });
    How can i add this to sencha Architect toolbox as control. So i can use for grid. Is there any example?
    Can you please someone tell me how to do this?

    If anyone have done similar kind of work. please help me.

    Thanks in advance.
    You don't have to add this to the toolbox. First, in your Project Inspector box you will see an option for "Resources." Highlight the Resources node then click the "+" sign in the upper right. From there, Select JS Resource. Now you can add your class to the project by supplying the url to the Config section for the JS Resource.

    Next, add a generic column to your grid and change the createAlias config to "checkcolumn" (or whatever you have aliased it as in your custom class).
    Jason Minnick
    Sencha Architect Development Team

  3. #3
    Sencha Premium Member
    Join Date
    Feb 2013
    Location
    Bangalore, India
    Posts
    68

    Default

    Hi,

    Thanks a lot.
    Its work for me.

    Its mean i can not add any customize control to sencha architect toolbox?
    For example, In combobox picker, i am adding grid by using plugins.

    http://www.sencha.com/forum/showthread.php?140667

    If i want to use anywhere in my sencha project then i am doing like this in 'show' action for window.

    var gridCmbMultiColumnBox = new Ext.ux.GridComboBox({
    fieldLabel : 'Grid ComboBox',
    multiSelect : false,
    displayField : 'DisplayMember',
    valueField : 'DisplayMember',
    width : 250,
    labelWidth : 100,
    labelAlign: 'Left',
    store : store,
    typeAhead : true,
    queryMode : 'local',
    matchFieldWidth : false,
    pickerAlign: 'bl',
    gridCfg : {
    store : store,
    height: 200,
    width: 400,
    columns : [
    {
    text : 'ValueMember',
    width : 100,
    dataIndex : 'ValueMember'
    },{
    text : 'ContractBasis',
    width : 100,
    dataIndex : 'ContractBasisName'
    }, {
    text : 'Description',
    width : 160,
    dataIndex : 'Description'
    }]
    }
    });

    Instead of this, How i can add this to sencha toolbox?
    So i can drag from toolbox and i will set config settings.

    Its possible or not?

  4. #4
    Sencha User
    Join Date
    Jan 2009
    Location
    Frederick, Maryland
    Posts
    925

    Default

    Right now, you cannot do what you are asking with a grid column. It's definitely easiest to do it the way I demonstrated. That isn't to say it will not be an option in the future.
    Jason Minnick
    Sencha Architect Development Team

  5. #5
    Sencha Premium Member
    Join Date
    Feb 2013
    Location
    Bangalore, India
    Posts
    68

    Default

    Ok. Thank you.

    What about gridComboBox?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •