Categories | Question details Back To List | ||||||||
Autowidth(s) for columns is not working You have demo that shows how to do auto column widths. Here is how its supposed to work: mygrid.setInitWidths("80,*,100,80,40,40,40,80") I have tried this with the Free version of the grid, and its not working. In IE, i get errors, while in Firefox, the interface is screwed up. Also, I saw another knowledgebase post where you responded that there is 'no such feature' as auto column widths, yet you have a demo of it that works. So, whats the deal with the auto column width feature? Answer posted on Nov 15, 2007 04:12 Actually flexible width ( size as "*" ) works for both pro and standard editions - please check attached sample. Attachments (1)
Answer posted by Tom Ince on Jun 13, 2008 08:48 This doesn't work for me either. I use only IE7. Here's mode init code : projectGrid = new dhtmlXGridObject( 'project' );projectGrid.imgURL = "dhtmlx\imgs"; projectGrid.setHeader( "TFA, Project ID #, Project Title, Start, Finish, POP Start, POP Finish, Duration % Complete, Project % Complete, Comments, Schedule Indicator, POP End Near, Responsible Manager" ); projectGrid.setInitWidths( "60, *, *, *, *, *, *, *, *, *, *, *, *" ); projectGrid.setColTypes( "ro, ro, ro, ro, ro, ro, ro, ro, ro, txt, ro, ro, ro" ); projectGrid.setSkin( gridSkin ); projectGrid.enableMultiline( true ); projectGrid.enableMultiselect( false ); projectGrid.init(); projectGrid.attachEvent( 'onRowSelect', projectGrid_RowSelect ); It throws an "Invalid Argument" exception here : this.hdr.rows[0].cells[i].style.width=this.cellWidthPX[i]+"px"; The grid works fine, as long as I put numbers in all the setInitWidths, or use the setInitWidthsP with numbers. It looks like this code is trying to set the CSS width style to "*px", which is invalid. Answer posted by Support on Jun 13, 2008 09:58 Just remove unnecessary white-spaces in setInitWidths and setColTypes commands and it will work correctly projectGrid.setInitWidths( "60,*,*,*,*,*,*,*,*,*,*,*,*" ); projectGrid.setColTypes( "ro,ro,ro,ro,ro,ro,ro,ro,ro,txt,ro,ro,ro" ); Answer posted by Tom Ince on Jun 16, 2008 06:54 Thanks, while it no longer gives errors, it's still doesn't work as expected. The columns are autosize for the initial width, but when the web page is resized (and the grid is resized as well), then the headers have static width. While I could see that once the header columns have been manually changed, you wouldn't want to auto-size them anymore. If I load the page, and resize the page without any manual changes to the header widths, the headers should continue to auto-size, IMO. Answer posted by Support on Jun 17, 2008 05:22 >>the headers should continue to auto-size, IMO. The headers will autoresize, but grid need to be informed that its sizes changed. You can call grid.setSizes() to force size update. Or add next line to the grid initialization grid._setAutoResize(); after which grid will automatically reset sizes, each time as page reloaded. |