Categories | Question details Back To List | ||
Getting height of rows in DHTMLXGrid Greetings! I'm having some issues in dynamically obtaining the row height in DHTMLXGrid and was wondering if anyone can help. To give you an idea of the bigger picture, I am writing a piece of JavaScript which will resize the grid to 'fit' around the number of rows without leaving whitespace at the bottom. In order to create a general solution, I need to dynamically query the grid and obtain the value for the 'row height', which I can then multiply by the number of rows in the grid (obtained via the getRowsNum() function). This will obviously give me an idea of 'how big the grid should be'. My problem is that whilst I beleive there is a function in the API to set the row height, I cannot find a function to 'get' it. I was thinking about querying the DOM to get this information(?), but was hoping there was a more elegant solution. If anyone has any ideas as to how I would get the row height, or how to solve my problem as a whole, I'd love to her them! Many thanks, Simon Answer posted on Nov 12, 2008 05:16 >>I am writing a piece of JavaScript which will resize the grid to 'fit' around the number of rows without leaving whitespace at the bottom. Actually grid already has something similar grid.enableAutoHeight(true) >>I need to dynamically query the grid and obtain the value for the 'row height' You can try to use var height = grid._srdh||20; >>there is a function in the API to set the row height Actually there is no special API to set or get the height of row, it is defined in CSS for each skin. Answer posted by Simon Irving on Nov 12, 2008 06:40 Wow... as easy as that eh? Thanks very much... that seems to work! ... and I guess enableAutoWidth() does the same thing width-wise? ;) Thanks again... maybe I should take a closer look at the API documentation next time :) Answer posted by Support on Nov 12, 2008 07:02 >>... and I guess enableAutoWidth() does the same thing width-wise? ;) Yes, it works in similar manner for the width of grid. |