Jump to content

Recommended Posts

sample code to resize automaticaly uniDbGrid columns:

 

thanks to Oleg by the model code.
function reconfigure(sender, store, columns, oldStore, the, eOpts)
{
  Ext.each(columns, 
     function(column, index) {
        if (!sender.columnManager) {
          sender.columns[index].flex=1;  /*fit width, comment to disable*/
          sender.columns[index].minWidth = 150; /*min.size*/
        } else {
          sender.columnManager.columns[index].flex=1; 
          sender.columnManager.columns[index].minWidth = 150; 
        };        
     }
  )
}

Demo project Attached.

uniDBGrid_Column_AutoSize.rar

  • Like 1
Link to post
Share on other sites
  • 2 weeks later...
  • 2 weeks later...

Hi,

 

Alternative method:

 

UniSession.AddJS(UniDBGridName.JSName  + '.headerCt.forceFit=true;');

 

(Set OnCreate or OnShow event)

 

Is JSName granted to be unique? Or is it safer to use FormName[ GridName ] ?

Link to post
Share on other sites
  • 2 years later...
  • 8 months later...
  • 1 year later...
On 6/22/2018 at 2:43 AM, cgarrotti said:

Error:

 

Cannot set property 'forceFit' of undefined

 

why?

 

A autowidth way:

UniDBGrid1->ClientEvents->ExtEvents,see the Ext.data.Store page,

add store.load event as follow:

function store.load(sender, records, successful, operation, eOpts)
{
  sender.grid.columnManager.columns.forEach(function(col){col.autoSize()})
}

Link to post
Share on other sites
  • 1 month later...
On 12/13/2019 at 4:03 PM, 55143681 said:

 

A autowidth way:

UniDBGrid1->ClientEvents->ExtEvents,see the Ext.data.Store page,

add store.load event as follow:

function store.load(sender, records, successful, operation, eOpts)
{
  sender.grid.columnManager.columns.forEach(function(col){col.autoSize()})
}

Hello!

How apply and run this code in OnClick event of UniButton RunTime?

Link to post
Share on other sites
4 hours ago, Артем said:

How apply and run this code in OnClick event of UniButton RunTime?

Like this for example:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniDBGrid1.JSInterface.JSCode(#1'.columnManager.columns.forEach(function(col){col.autoSize()});');
end;

 

Link to post
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...