Jump to content

StringGrid column autofit


skafy

Recommended Posts

How to set width of columns to automaticly fit the StringGrid.

 

I tried function witch worked for me on DBGrid component but it doesn't work here.

 

function columnresize(ct, column, width, eOpts)
{
  if (column.fedit) {
    column.fedit.setWidth(width - 2)
  }
}

 

please help.

 

Best regards

Link to comment
Share on other sites

Hi,

 

For now you can try this:

 

UniStringGrid1 -> ClientEvents -> ExtEvents ... [Ext.grid.Panel] add reconfigure fn:

function reconfigure(sender, store, columns, oldStore, the, eOpts)
{
  columns.forEach(function(el){el.flex=1})
}

Best regards.

Link to comment
Share on other sites

  • 2 years later...

Hi,

 

For now you can try this:

 

UniStringGrid1 -> ClientEvents -> ExtEvents ... [Ext.grid.Panel] add reconfigure fn:

function reconfigure(sender, store, columns, oldStore, the, eOpts)
{
  columns.forEach(function(el){el.flex=1})
}

Best regards.

 

 

Hy 

 

This solution is great thank ! 

 

But i have a problem, how i can set a witdh of 1 column ?   beacause its too large for just a id 

 

Thanks a lot 

Link to comment
Share on other sites

Hi,

Which edition and build are you using?

 

Try to use maxWidth for this, for example:

function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts)
{
    columns[0].maxWidth = 50;
    columns[1].maxWidth = 75;
    
    columns.forEach(function(el){el.flex=1});
}

Best regards,

  • Upvote 1
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 years later...
On 2/8/2018 at 2:27 PM, Sherzod said:

Try to use maxWidth for this, for example:


function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts)
{
    columns[0].maxWidth = 50;
    columns[1].maxWidth = 75;
    
    columns.forEach(function(el){el.flex=1});
}

 

Can it be changed at runtime somehow, like with Unisession.AddJS?

Link to comment
Share on other sites

 

1 hour ago, Sherzod said:

Hello,

What exactly?

Set or edit UniStringGrid column flex,maxWidth,minWidth ExtJS properties. At runtime.

Like:

UniStringGrid1.Columns[3].Flex:=1;

UniStringGrid1.Columns[3].maxWidth:=100;

I know these properties are not available right now at server side, but maybe it could be done with JavaScript?

I need to modify these settings at random time, not just at grid creation.

 

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...