ttamturk Posted October 9, 2014 Posted October 9, 2014 Hi, Most of the time when using css+html, width's are set by percentage like %80, %100. We need that on uniDBGrid's Column's with too because when browser's size changed columns are set still and we can't use all the space we have. Thanks.
zilav Posted October 9, 2014 Posted October 9, 2014 It has already been posted several times how to autowidth columns, I made a helper function procedure UniDBGridAutoWidth(aGrid: TUniDBGrid; aFieldName: string = ''); var s: string; i: Integer; begin if aFieldName = '' then s := 'sender.headerCt.forceFit=true;' else with TStringList.Create do try Delimiter := ';'; StrictDelimiter := True; DelimitedText := LowerCase(aFieldName); for i := 0 to Pred(aGrid.Columns.Count) do if IndexOf(LowerCase(aGrid.Columns[i].FieldName)) <> -1 then s := s + Format('columns[%d].flex=1;', [i]); finally Free; end; if s <> '' then aGrid.ClientEvents.ExtEvents.Add(Format( 'beforereconfigure=function beforereconfigure(sender, store, columns, oldStore, the, eOpts)' + '{%s}', [s]) ); end; Pass a field name to autowidth, or several field names separated with ';'. If you don't pass any fields, all of them will have autowidth relating to their width set in designer. 3
ttamturk Posted October 10, 2014 Author Posted October 10, 2014 Thanks but I don't look for a solution, this topic is for featured and this is just a request. Why i have to do extra coding just to make a column width auto? If this is a web-framework it has to support web interface. This is better for uniGUI. Best
Administrators Farshad Mohajeri Posted October 10, 2014 Administrators Posted October 10, 2014 Why i have to do extra coding just to make a column width auto? If this is a web-framework it has to support web interface. Well, in all other web frameworks you can't do anything useful without "lots of extra coding". uniGUI hides lots of these details for you and internally implements the code. If you try to code directly in Ext JS or similar almost all of such details must be coded manually.
ttamturk Posted October 10, 2014 Author Posted October 10, 2014 Well, in all other web frameworks you can't do anything useful without "lots of extra coding". uniGUI hides lots of these details for you and internally implements the code. If you try to code directly in Ext JS or similar almost all of such details must be coded manually. Of course, every framework, component packages etc. has much more detail after front-end but some functions/methods or properties are used by developers all the time like this issue ""Column Width". These common interfaces are valuable for a component library such as uniGUI. I am not try to offend or discredit here, i am try to make this framework better. best
Administrators Farshad Mohajeri Posted October 10, 2014 Administrators Posted October 10, 2014 Thank you
molla2005b Posted May 1, 2015 Posted May 1, 2015 It has already been posted several times how to autowidth columns, I made a helper function procedure UniDBGridAutoWidth(aGrid: TUniDBGrid; aFieldName: string = ''); var s: string; i: Integer; begin if aFieldName = '' then s := 'sender.headerCt.forceFit=true;' else with TStringList.Create do try Delimiter := ';'; StrictDelimiter := True; DelimitedText := LowerCase(aFieldName); for i := 0 to Pred(aGrid.Columns.Count) do if IndexOf(LowerCase(aGrid.Columns[i].FieldName)) <> -1 then s := s + Format('columns[%d].flex=1;', [i]); finally Free; end; if s <> '' then aGrid.ClientEvents.ExtEvents.Add(Format( 'beforereconfigure=function beforereconfigure(sender, store, columns, oldStore, the, eOpts)' + '{%s}', [s]) ); end; Pass a field name to autowidth, or several field names separated with ';'. If you don't pass any fields, all of them will have autowidth relating to their width set in designer. hi this solution not worked in Grouped UniDBGrid. thanks.
tappatappa Posted May 20, 2015 Posted May 20, 2015 related topic? http://forums.unigui.com/index.php?/topic/5247-unidbgrid-autosize-column/
Recommended Posts