By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,712 Members | 2,111 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,712 IT Pros & Developers. It's quick & easy.

treegrid row height problem

P: 9
Hi,

I want the rows in the treegrid to have the same height, and if there's a cell with a lot of content, to be able to click on that cell or row, and the row height will increase - so that all the cell content is visible.

By default if the MaxHeight is not set and VarHeight is set to 1, the rows height adjust so that all the cells content is visible, but I want this to happen only after clicking the cell or row.

Any idea how to do that?

Thanks in advance.
Aug 10 '08 #1
Share this Question
Share on Google+
12 Replies


acoder
Expert Mod 15k+
P: 16,027
Post your code or a link. Are you using a third party treegrid?
Aug 11 '08 #2

P: 9
Hi,

I've downloaded treegrid zip file from :

http://www.treegrid.com/TreeGrid5_6/...STreeGrid.html

my files:

the htnl file:

[HTML]<html>
<head>
<script src="../../Grid/GridE.js"> </script>

</head>
<body>

<div style="WIDTH:100%;HEIGHT:90%">
<bdo Layout_Url="myFirstDef.xml" Data_Url="myFirstData.xml"></bdo>
</div>

</body>
</html>
[/HTML]

The data file:

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <Grid>
  3.    <Body>
  4.       <B>
  5.         <I id="c" Def="Node" A="Order 003" C="aaaaaaaa bbbbbbbb ccccccccccc dddddddddd">
  6.  
  7.  
  8.   </I>
  9.  
  10.  
  11.       </B>
  12.    </Body>
  13. </Grid>
  14.  
The layout file:

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <Grid>
  3.    <Cfg id='First'
  4.     VarHeight="1"
  5.  
  6.  
  7.     />
  8.  
  9.    <Cols>
  10.  
  11.       <C Name='C' Type="Lines" CanEdit="2" Width="100"/>
  12.  
  13.    </Cols>
  14.  
  15.  
  16.   <Def>
  17.  
  18.         <D Name="R" MaxHeight="17" />
  19.     </Def>
  20.     <Header 
  21.         C="Date" 
  22.  
  23.     />
  24.  
  25. </Grid>

Hope that helps you to help me :)
Aug 11 '08 #3

acoder
Expert Mod 15k+
P: 16,027
Have you been through the tutorials first?
Aug 11 '08 #4

P: 9
yes I have, and I couldn't find an example, nor documentation of what I need :( though it's seems like basic functionality...
Aug 11 '08 #5

acoder
Expert Mod 15k+
P: 16,027
Have a look at the API and see if you can extend it. If not, post your attempt.
Aug 11 '08 #6

P: 9
I've looked at this API, I only see expand or extend attributes that concrens expanding or collapsing of tree children. If I set the MaxHeight to one line - I don't see how I can expand the row onClick.
I have an example of a a very simple tree with one column and one row. The column is non editable (CanEdit="2"), MaxHeight=17.

The html file:

[HTML]<html>
<head>
<script src="../../Grid/GridE.js"> </script>

</head>
<body>

<div style="WIDTH:100%;HEIGHT:90%">
<bdo Layout_Url="myFirstDef.xml" Data_Url="myFirstData.xml"></bdo>
</div>

</body>
</html>
[/HTML]

The configuration (layout) file:

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <Grid>
  3.    <Cfg id='First'
  4.     VarHeight="1"
  5.  
  6.  
  7.     />
  8.  
  9.    <Cols>
  10.  
  11.       <C Name='C' Type="Lines" CanEdit="2" Width="150"/>
  12.  
  13.    </Cols>
  14.  
  15.  
  16.   <Def>
  17.  
  18.         <D Name="R" MaxHeight="17"/>
  19.     </Def>
  20.     <Header 
  21.         C="Date" 
  22.  
  23.     />
  24.  
  25. </Grid>
  26.  
Data file:

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <Grid>
  3.    <Body>
  4.       <B>
  5.         <I id="c" C="aaaaaaaa bbbbbbbb ccccccccccc dddddddddd">
  6.  
  7.  
  8.   </I>
  9.  
  10.  
  11.       </B>
  12.    </Body>
  13. </Grid>

It would be great if you could help me with that.
Aug 12 '08 #7

acoder
Expert Mod 15k+
P: 16,027
What about the UpdateRowHeight() method?

PS. please use code tags when posting code.
Aug 12 '08 #8

P: 9
I have a temporary problem with my computer and I don't have access to the html I've created, but I added these lines to the head section of it:

[HTML] <script type="text/javascript">Grids.OnClick = function(grid, row, col, x, y, handled, event) {grid.UpdateRowHeight(row);}</script>[/HTML]

I see that I catch the event (when I put alert in the function I see it), but the row is not expanded..... :(
Aug 12 '08 #9

P: 9
better use of code tags:

[HTML]<script type="text/javascript">
Grids.OnClick = function(grid, row, col, x, y, handled, event)
{
grid.UpdateRowHeight(row);
}
</script>
[/HTML]
Aug 13 '08 #10

P: 9
This works :)

[HTML]<script type="text/javascript">
Grids.OnClick = function(grid, row, col, x, y, handled, event)
{
row.MaxHeight="200";
grid.RefreshRow(row);
}
</script>[/HTML]
Aug 13 '08 #11

acoder
Expert Mod 15k+
P: 16,027
Glad you got it working. Thanks for posting the solution :)
Aug 13 '08 #12

P: 9
you welcome :) and thanks for your time.
Aug 16 '08 #13

Post your reply

Sign in to post your reply or Sign up for a free account.