Jump to content

Reverse the columnnumber in UniDbGrid


Ario.Paxaz

Recommended Posts

11 hours ago, Ario.Paxaz said:

The row number should be the first column and the selection column should be in the second position.

Hello,

You can try to use this approach:

1. UniDBGrid.ClientEvents.UniEvents ->

function beforeInit(sender, config)
{    
    config.checkColumnMoved = false;
}

2. UniDBGrid.ClientEvents.ExtEvents ->

function columnschanged(ct, eOpts)
{
    var cols = ct.getGridColumns();
    if (cols && cols.length>1 && ct.grid.checkColumnMoved == false) {
        if (ct.getGridColumns()[0].xtype == 'checkcolumn' && ct.getGridColumns()[1].xtype == 'rownumberer') {
            ct.grid.checkColumnMoved = true;
            ct.move(0, 1);
        }
    }
}

 

Link to comment
Share on other sites

Hi,

I use the following code for the click title of the column that has a checkbox.
It interferes with the code you sent.

 

function viewready(sender, eOpts)
{
    col = sender.getColumnManager().getColumns()[0];
    if (col && col.xtype == 'checkcolumn' && !col.dataIndex) {
        col.dataIndex = -3;
    }
}

 

Link to comment
Share on other sites

  • 2 weeks later...
On 10/14/2023 at 11:37 PM, Ario.Paxaz said:

Did you find a solution?

Hello,

Yes, 

Here's a workaround.

1.  Remove previous codes from events.

2. MainForm.Script ->

Ext.override(Ext.grid.Panel, {
    reconfigure: function() {
        this.callParent(arguments);
        
        var cols = this.getColumnManager().getColumns();
        if (cols[0].xtype == 'checkcolumn' && cols[1].xtype == 'rownumberer') {
            var _col = cols[0];
            this.headerCt.move(0, 1);
            Ext.defer(function () {
                _col.dataIndex = -3
            }, 1000);
        }
    }
});

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...