soledue Posted October 24, 2012 Share Posted October 24, 2012 hi, is difficle activate the property of dbgrid forceFit? Quote Link to comment Share on other sites More sharing options...
aln02 Posted October 25, 2012 Share Posted October 25, 2012 Add on MainForm.Script function OnGridResize(sender, adjWidth, lastColNotResize) { var TotWidth=0, VarWidth=0, ResizableColumnCount=0, i1=0, i2=0, colModel=sender.getColumnModel(); lastColNotResize=lastColNotResize||0; if (lastColNotResize>0) {i2=lastColNotResize} else {i1=-lastColNotResize}; for(i=1;i<colModel.columns.length;i++) {TotWidth+=colModel.columns.width; ResizableColumnCount++;} TotWidth+=colModel.columns.length; VarWidth=adjWidth-TotWidth; if ((ResizableColumnCount-i1-i2)>0){VarWidth=VarWidth/(ResizableColumnCount-i1-i2)} for(i=1+i1;i<colModel.columns.length-i2;i++) {colModel.setColumnWidth(i, colModel.columns.width+VarWidth)} } and Add on unidbgrid.ClientEvents function OnReconfigure(sender, store, colModel) { OnGridResize(sender, sender.width, 3); } and function OnResize(sender, adjWidth, adjHeight, rawWidth, rawHeight) { OnGridResize(sender, adjWidth, 3); } Quote Link to comment Share on other sites More sharing options...
soledue Posted October 25, 2012 Author Share Posted October 25, 2012 Great! but if "forceFit" there why not use it? Add on MainForm.Script function OnGridResize(sender, adjWidth, lastColNotResize) { var TotWidth=0, VarWidth=0, ResizableColumnCount=0, i1=0, i2=0, colModel=sender.getColumnModel(); lastColNotResize=lastColNotResize||0; if (lastColNotResize>0) {i2=lastColNotResize} else {i1=-lastColNotResize}; for(i=1;i<colModel.columns.length;i++) {TotWidth+=colModel.columns.width; ResizableColumnCount++;} TotWidth+=colModel.columns.length; VarWidth=adjWidth-TotWidth; if ((ResizableColumnCount-i1-i2)>0){VarWidth=VarWidth/(ResizableColumnCount-i1-i2)} for(i=1+i1;i<colModel.columns.length-i2;i++) {colModel.setColumnWidth(i, colModel.columns.width+VarWidth)} } and Add on unidbgrid.ClientEvents function OnReconfigure(sender, store, colModel) { OnGridResize(sender, sender.width, 3); } and function OnResize(sender, adjWidth, adjHeight, rawWidth, rawHeight) { OnGridResize(sender, adjWidth, 3); } Quote Link to comment Share on other sites More sharing options...
aln02 Posted October 25, 2012 Share Posted October 25, 2012 I tried, but for the unclear reasons doesn't work Quote Link to comment Share on other sites More sharing options...
soledue Posted October 26, 2012 Author Share Posted October 26, 2012 I know and why I'm asking for help :-) I tried, but for the unclear reasons doesn't work 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;} on unidbgrid.ClientEvents.ExtEvents Quote Link to comment Share on other sites More sharing options...
soledue Posted June 28, 2013 Author Share Posted June 28, 2013 wow great thanks Quote Link to comment Share on other sites More sharing options...
aln02 Posted June 28, 2013 Share Posted June 28, 2013 also for certain columns you can make, for example: function OnReconfigure(sender, store, colModel){var col; if (!sender.columnManager) {col=sender.columns;} else {col=sender.columnManager.columns;}col[0].flex=1;col[2].flex=1;col[5].flex=1; } Quote Link to comment Share on other sites More sharing options...
Beginner Posted May 4, 2016 Share Posted May 4, 2016 Not work properly 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.