Home
Analytics
Extend Table/Grid to Fit Page for different row height
udezonan
Hello
i'm new in using birt
i know there is a solution for this but that only work if the row height is fix
but how about if the height is not fix?
i have a table that the height expand according to the data from database.
i put the data in a text.
is there any way to get generated row height or number of text row?
or there is other solution?
thanks in advance
Find more posts tagged with
Comments
pabloMG
Is your problem that you have data that needs more than one line in some cells? If so, select the label in the cell, go to Properties -> Advanced -> Text -> Whitespace and select Auto.
udezonan
hello
no that not the issue i use text for that.
there will be multiple record where each will be for one row with multiple column
each row height will extend according to the length of the data
BirtRunn
I am not so much clear about your actual problem. Anyways. I am not sure about how to get height but if you want to know how many rows are fetched by data set, it is possible.
In Expression Builder -> select Available Coulmn Bindings -> select control name where you have bound data set
-> in 'Double Click to insert' section you will see 'RowNum' as last element which is BIRT's standard row counter parameter.
The value returned is total number of rows fetched by dataset.
mwilliams
Hi udezonan,<br />
<br />
I don't know if there's a good way to do this with random row heights. I'll try a couple things and post if I come up with something. You might log an enhancement request for an easy way to push the footer down to the bottom of the page for all situations. You can do so at <a class='bbc_url' href='
http://www.birt-exchange.org/org/resources/bug-reporting/'>the
bug report and enhancement request page</a>
udezonan
<blockquote class='ipsBlockquote' data-author="'BirtRunn'" data-cid="67737" data-time="1282731585" data-date="25 August 2010 - 03:19 AM"><p>
I am not so much clear about your actual problem. Anyways. I am not sure about how to get height but if you want to know how many rows are fetched by data set, it is possible.<br />
In Expression Builder -> select Available Coulmn Bindings -> select control name where you have bound data set<br />
-> in 'Double Click to insert' section you will see 'RowNum' as last element which is BIRT's standard row counter parameter.<br />
The value returned is total number of rows fetched by dataset.<br /></p></blockquote>
<br />
actually i was referring to this issue <a class='bbc_url' href='
http://www.birt-exchange.org/org/devshare/designing-birt-reports/989-extend-table-to-fit-page/'>http://www.birt-exchange.org/org/devshare/designing-birt-reports/989-extend-table-to-fit-page/</a>
; but this solution only works for same row heights. if i set fix height some of the data will be hidden even though i've set overflow to visible<br />
<br />
mwilliams<br />
<br />
i hope you can find the workaround for this. i thank you in advance for your help regardless of the outcome.<br />
i'll log the request for this later
mwilliams
Unless you set a row height, there doesn't seem to be a way to access the actual rendered height of the row to use in your design. This probably makes it impossible to do in any easy way. A way that you could do it that might be pretty messy would be to count the characters of the column that's causing the row to be taller or shorter and either compute a probable amount of rows created by that many characters or substring the text with breaks so that you know for sure how many rows the row takes up. You can then keep track of this value and reset it on page breaks, which you may have to insert using script when you know your page is full. Then, you'd finish with the same idea from that post of mine from the devShare that you linked to above to push the footer down the rest of the page. Like I said, this will be messy, most likely, but it should work. Good luck if you try it! Let me know if you have questions.
udezonan
yea i notice that to.
my first idea was to get the number of row in the text element so i can use it in your previous example
but now i realize it quite impossible to know that
thanks for the idea. yes it will be hard and messy since i have to consider the width of the table column
which can turn my text to one or more rows. i'll try as much as i can.
will post the sample if i succeed
thanks again for your help
udezonan
Hello
ok this what i have so far
i still cannot get the calculation right
just how do you calculate the number of character for a row since some character has different width?
can anyone review my work and give some idea how to calculate it?
can we get the width of each character?
if i cannot solve this by tomorrow i'm have to switch to ireport
because my friend said i don't have to worry about this issue in ireport
some ouput
mwilliams
If you fix the column width, you could use substrings or split the string into an array of words and make your own rows with html and display the html in a text box in your row. This way you'd for sure know that each row fits and don't have to worry about character width because you'd make sure to use a limit of characters that would fit in the worst case of like all uppercase W's or something.
udezonan
Hai<br />
<br />
if anyone still interested i think i have manage to Extend Table/Grid to Fit Page for different row height<br />
but you still have to few more tweaking for row per page and max text length<br />
<br />
on initialize script<br />
////////////////////////<br />
TotalDataRow = 0;<br />
maxCharacterPerRow = 46;<br />
maxRowsPerPage = 40;<br />
extendTable = "";<br />
////////////////////////////<br />
<br />
on fetch script<br />
////////////////////////////<br />
if(count < data.size()){<br />
<br />
row["flNo"] = count+1;<br />
row["flChckList"] = data.get(count).getChecklistItem();<br />
row["flClauseNo"] = data.get(count).getClauseNo(); <br />
tmp = data.get(count).getFindings().replace("\n","<br>");<br />
view = "";<br />
if(count != (data.size()-1))<br />
{<br />
extendTable="";<br />
//tmp=tmp+"<br><br>";<br />
}<br />
tmpList = tmp.split("<br>");<br />
for(a=0;a<tmpList.length;a++)<br />
{<br />
kira=1;<br />
tmp2 = tmpList[a].split(" ");<br />
bil2=0;<br />
for(b=0;b<tmp2.length-1;b++)<br />
{<br />
bil2 += IA.TextCount(tmp2
)+1;<br />
bilExtra = bil2+IA.TextCount(tmp2[b+1]);<br />
//view+="("+(bilExtra>maxCharacterPerRow)+" = "+bilExtra+" - "+maxCharacterPerRow+")";<br />
if(bilExtra>maxCharacterPerRow)<br />
{<br />
view += tmp2
+"<br>";<br />
kira+=1;<br />
bil2=0; <br />
}else<br />
{<br />
view += tmp2
+" "; <br />
}<br />
}<br />
if(tmp2.length==0)<br />
{<br />
view +=tmpList[a]+"";<br />
kira+=1;<br />
}else<br />
{<br />
if(count == (data.size()-1) && IA.TextCount(tmp)<46){<br />
view += tmp2[tmp2.length-1]+"";<br />
}else<br />
{<br />
view += tmp2[tmp2.length-1]+"<br>";<br />
}<br />
//kira+=1;<br />
}<br />
//view+="("+tmp2.length+")";<br />
TotalDataRow=TotalDataRow+kira;<br />
//bil = tmpList[a].length;<br />
//multi = bil/maxCharacterPerRow;<br />
//intmulti = parseInt(multi);<br />
//count=intmulti;<br />
//if(bil>(intmulti*maxCharacterPerRow))<br />
// kira = intmulti+1<br />
// TotalDataRow=TotalDataRow+kira; <br />
} <br />
if(tmpList.length==0)<br />
TotalDataRow = 1;<br />
if(count != (data.size()-1))<br />
{<br />
view += "<br><br>";<br />
TotalDataRow = TotalDataRow+2;<br />
} <br />
row["flFindings"] = view;//tmp;<br />
row["flStatus"] = data.get(count).getStatus();<br />
row["flEcarNo"] = data.get(count).getCarno_ofi();<br />
<br />
txt="";<br />
if(count == (data.size()-1))<br />
{<br />
//TotalDataRow=TotalDataRow+(2*data.size());<br />
page = TotalDataRow/maxRowsPerPage;<br />
pageInInt = parseInt(page);<br />
rowForLastPage = maxRowsPerPage - ((TotalDataRow) - (maxRowsPerPage*pageInInt));<br />
//txt = "a<br>a<br>"+rowForLastPage+"- "+(maxRowsPerPage*pageInInt)+"-"+pageInInt+"-"+(TotalDataRow)+"-"+maxRowsPerPage;<br />
//9- 80-2-111-40<br />
if(pageInInt>1)<br />
rowForLastPage = rowForLastPage-1;<br />
else<br />
rowForLastPage = rowForLastPage+1;<br />
for(q=0;q<rowForLastPage;q++)<br />
{<br />
txt +="<br>"; <br />
}<br />
//row["flFindings"] = row["flFindings"] +txt;<br />
}else<br />
{<br />
txt="";<br />
}<br />
row["tableExtend"]=txt;<br />
count++;<br />
return true;<br />
}<br />
<br />
return false;<br />
///////////////////////////////////////////////////////////<br />
<br />
also need some cleaning on the code<br />
i use java class to get text length since i get nothing when i use text.length in the script<br />
<br />
<br />
here the design<br />
<br />
mwilliams
udezonan,
This would be a great post for the devShare!
udezonan
hai all
still this code is not perfect
some time you will have an extra page with 2 or 3 empty row
i only test it with few set of data and 1 set of design
if that is ok with you then this maybe your solution temporary
until BIRT implement something to solve this issue
mwilliams
When you log the enhancement request, be sure to put the info in here so that others who have this same issue that happen upon this thread will be able to go to the request and vote for it.
FrizzaUK
Hi,
I don't know whether this sorts your problem out but if you click on the row that you wish to dynamically expand (the whole row not just a single cell). Then within the Property Editor, click the General tab, set the 'Height' value to 100 and the measure to '%'.
I have used this myself to handle chunks of text that range from one line to say 20 lines.
Matt
keerthink
<p>Hello Michael,</p>
<p> </p>
<p>I have my table set to 100% height, but it only takes up the height of maximum content in each row. How do I extend my table to cover the entire available height irrespective of the number of rows on that page...?</p>
<p>I am using version 4.4.2</p>
<p> </p>
<p>Thank you</p>
mwilliams
<p>This still works the same as it always has, unfortunately. You can either use the master page footer or you can extend the page by the number of rows needed by adding extra footer rows. The adding of extra rows obviously works best if you have a fixed row height. Otherwise, you have to try to calculate the number of lines the rows on a page take up so that you know how far to extend the page.</p>