okkoos Posted January 24, 2013 Share Posted January 24, 2013 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 : Boolean★2 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. Quote Link to comment Share on other sites More sharing options...
okkoos Posted January 27, 2013 Author Share Posted January 27, 2013 Hi anyone having solution yet? Quote Link to comment Share on other sites More sharing options...
mhmda Posted January 28, 2013 Share Posted January 28, 2013 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) } Quote Link to comment Share on other sites More sharing options...
okkoos Posted January 29, 2013 Author Share Posted January 29, 2013 Hi Mohamed; thanks for your reply I tried your codes but can not take effect. regards. Quote Link to comment Share on other sites More sharing options...
mhmda Posted January 30, 2013 Share Posted January 30, 2013 Hi, It's working greate ! 1. the 'OnResize' is an event for the DBGRID in Client Side Events, please follow me: Don't forget this line (it's very important): //validate if(sender.columns.length==0) return; Quote Link to comment Share on other sites More sharing options...
okkoos Posted January 30, 2013 Author Share Posted January 30, 2013 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. Quote Link to comment Share on other sites More sharing options...
aln02 Posted June 7, 2013 Share Posted June 7, 2013 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 Quote Link to comment Share on other sites More sharing options...
molla2005b Posted May 1, 2015 Share Posted May 1, 2015 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. Quote Link to comment Share on other sites More sharing options...
Beginner Posted May 4, 2016 Share Posted May 4, 2016 Can you help how auto fit column? After loading data Quote Link to comment Share on other sites More sharing options...
TRodrigues Posted September 6, 2017 Share Posted September 6, 2017 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. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 7, 2017 Share Posted September 7, 2017 Hi, Maybe you wanted like this ?: http://forums.unigui.com/index.php?/topic/6273-dbgrid-spaltenbreite-automatisch-anpassen/&do=findComment&comment=31997 Best regards, 1 Quote Link to comment Share on other sites More sharing options...
TRodrigues Posted September 20, 2017 Share Posted September 20, 2017 Hi, Maybe you wanted like this ?: http://forums.unigui.com/index.php?/topic/6273-dbgrid-spaltenbreite-automatisch-anpassen/&do=findComment&comment=31997 Best regards, First of all, thank you very much for your response. This works, but it's slow for me to load 25 records with 60 columns, or maybe I'm doing something wrong. Quote Link to comment Share on other sites More sharing options...
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.