NelsonFS 27 Posted April 16, 2015 Share Posted April 16, 2015 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 1 Quote Link to post Share on other sites
docjones 19 Posted April 21, 2015 Share Posted April 21, 2015 how to use it ? example will be appreciated. Quote Link to post Share on other sites
zilav 82 Posted April 22, 2015 Share Posted April 22, 2015 Like this http://forums.unigui.com/index.php?/topic/4627-set-tunidbgrids-column-width-with-percentage/&do=findComment&comment=23172 Quote Link to post Share on other sites
fcarvalho4 23 Posted April 27, 2015 Share Posted April 27, 2015 ExtEvents.reconfigure Quote Link to post Share on other sites
dieger 15 Posted May 6, 2015 Share Posted May 6, 2015 Hi, Alternative method: UniSession.AddJS(UniDBGridName.JSName + '.headerCt.forceFit=true;'); (Set OnCreate or OnShow event) 1 Quote Link to post Share on other sites
tappatappa 21 Posted May 20, 2015 Share Posted May 20, 2015 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 ] ? Quote Link to post Share on other sites
dieger 15 Posted May 20, 2015 Share Posted May 20, 2015 Is JSName granted to be unique? Or is it safer to use FormName[ GridName ] ? JSName is unique. Quote Link to post Share on other sites
zanona 0 Posted October 16, 2017 Share Posted October 16, 2017 What would be the solution for TUniMDbGrid? Thanks Zanona Quote Link to post Share on other sites
cgarrotti 0 Posted June 21, 2018 Share Posted June 21, 2018 Hi, Alternative method: UniSession.AddJS(UniDBGridName.JSName + '.headerCt.forceFit=true;'); (Set OnCreate or OnShow event) Error: Cannot set property 'forceFit' of undefined why? Quote Link to post Share on other sites
55143681 17 Posted December 13, 2019 Share Posted December 13, 2019 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()}) } Quote Link to post Share on other sites
Артем 18 Posted January 18, 2020 Share Posted January 18, 2020 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? Quote Link to post Share on other sites
Sherzod 1183 Posted January 18, 2020 Share Posted January 18, 2020 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; Quote Link to post Share on other sites
Артем 18 Posted January 18, 2020 Share Posted January 18, 2020 1 hour ago, Sherzod said: Like this for example: procedure TMainForm.UniButton1Click(Sender: TObject); begin UniDBGrid1.JSInterface.JSCode(#1'.columnManager.columns.forEach(function(col){col.autoSize()});'); end; What it is #1? Quote Link to post Share on other sites
Sherzod 1183 Posted January 18, 2020 Share Posted January 18, 2020 3 hours ago, Артем said: What it is #1? This is equivalent to "UniDBGrid".JSName. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.