Jump to content

Recommended Posts

Posted

Hi

how can I set Ext.grid.Panel.forcefit property to true for autofit of UniDBGrid columns.

 

 

quotation from http://docs.sencha.com/ext-js/3-4/#!/api/Ext.grid.GridPanel  below;

 

" forceFit : Boolean2

Ttrue to force the columns to fit into the available width. Headers are first sized according to configuration, whether that be a specific width, or flex. Then they are all proportionally changed in width so that the entire content width is used.

Available since: Ext 4 "

regards.

 

Posted

Hi,

 

UniGui using Extjs 4.1.1 and this method has been changed, so I use this to auto resize columns at Client Side:

 

 



 function OnResize(sender, adjWidth, adjHeight, rawWidth, rawHeight)
{
  //get grid new width
  var grd_w=sender.getWidth();
  //validate
  if(sender.columns.length==0) return;
  //auto resize columns
  crnt_w=0.073*grd_w; //Calc width in 7.3%
  crnt_w=Math.floor(crnt_w);
 //change column width: strat from 1 for first column (when indecator is true) otherwize start from 0
 sender.columns[1].setWidth(crnt_w);//first column (0: is the indecator)
}







Posted

Hi,

 

It's working greate !

 

1. the 'OnResize' is an event for the DBGRID in Client Side Events, please follow me:

 

grd1.jpg

 

 

 

 

 

 

grd2.jpg

 

 

Don't forget this line (it's very important):

 

  //validate
  if(sender.columns.length==0) return;
 

Posted
Hi Mohammad;

thank you for your reply again. I understand now, you set every column width to some percentage of Dbgird. But not it need for me. Thanks for everything.

Regards.
  • 4 months later...
Posted

Hi. 

You can make so:
 

function OnReconfigure(sender, store, colModel)
{
sender.headerCt.forceFit=true;
}

 

or, for specified columns:

 

 

function OnReconfigure(sender, store, colModel)
{
if (!sender.columnManager) {
sender.columns[0].flex=1;
} else {
sender.columnManager.columns[0].flex=1;
}

}

 

in unidbgrid.ClientEvents.ExtEvents

  • 1 year later...
Posted

Hi. 

You can make so:

 

function OnReconfigure(sender, store, colModel)

{

sender.headerCt.forceFit=true;

}

 

or, for specified columns:

 

 

function OnReconfigure(sender, store, colModel)

{

if (!sender.columnManager) {

sender.columns[0].flex=1;

} else {

sender.columnManager.columns[0].flex=1;

}

 

}

 

in unidbgrid.ClientEvents.ExtEvents

hi

this solution not work in Grouped UniDBGrid.

tnx.

  • 1 year later...
  • 1 year later...
Posted

Hi. 

You can make so:

 

function OnReconfigure(sender, store, colModel)

{

sender.headerCt.forceFit=true;

}

 

in unidbgrid.ClientEvents.ExtEvents

 

Hi,

When I use:

sender.headerCt.forceFit=true;

 the result is this:

https://www.dropbox.com/s/sxwmwsmvscar3uw/UniGui_Grid.png?dl=0

 

 

Does anyone know how to solve it? The scroll disappears and it tries to fit into a single page.

What the property tries to do is to divide the size of the Grid by the existing columns. Right?

What I want is that the width of the column is the size of the largest text inserted in it.

  • 2 weeks later...

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