How can i set the with of crosstab cell from the events?
I tried doing
this.width="0in";
from onCreate() event but it does not work. I need help
If you're just trying to hide the cell, you might try something like this, in your crosstab script:
function onCreateCell( cellInst, reportContext )
{
if (cellInst.getCellID() == cellID#){
cellInst.getStyle().setDisplay("none");
}
}
Here's a link to the actual post that this comes from. It shows another option, for setting the actual width: http://www.birt-exchange.org/org/forum/index.php/topic/22736-dynamically-change-column-width-cross-tab/
Related
Hey guys can someone please enlighten me. what is the best way to have a label display SortedFilteredList size. I have a tableview and I want a label showing the current table row count while filtering using filterwhen
All you need to do is to create a StringBinding towards the sizeProperty of the SortedFilteredList. I've added an example to the TableViewSortFilterTest in the framework, check out https://github.com/edvin/tornadofx/blob/master/src/test/kotlin/tornadofx/testapps/TableViewSortFilterTest.kt for a complete example. Here I add an informational hbox to the bottom of the screen:
hbox(5) {
label("Filter count:")
label(data.sizeProperty.stringBinding { "$it records matching filter" })
}
The data property is my SortedFilteredList instance.
I am trying to change the recordtext of a display grid to a custom format. I am using a treeview as the selector that refreshes the display grid. I need to find the total records for the grid and I am able to get this value using the getGridParam records method when I click on the treeview node and load the display grid.
However, after I get this value and try to create the custom recordtext, the record count is the previous value, not the current records count. I know that the gridComplete happens before the loadComplete, but even placing the get in the gridComplete and the set int he loadComplete, it still doesn't work, even with a reloadGrid trigger. If I click on the treeview node twice, I get the correct value.
I am thinking it is a timing issue as to when the new value is ready to set the recordtext. Any help would be great, thanks in advance.
I recommend you to try updatepager method, which updates the information on the pager. Alternatively you can do for example the following:
loadComplete: function () {
var p = $(this).jqGrid("getGridParam");
p.records = 123;
p.recordtext = "My View {0} - {1} of <i>{2}<i>";
this.updatepager();
}
to see the viewrecords
I want to hide two of the crosstab columns based on some condition. I have been able to achieve it by using
function onPrepareCell( cell, reportContext )
if(some condition){
if( cell.getCellID() == cell#){
cell.getStyle().setDisplay("none");
}
}
in the onPrepare event of cross tab. It works fine in PDF,HTML format but the columns are not getting hidden when the format is Excel. I need to get this done soon please help
I got the answer from BIRT exchange i am posting the answer here so that it may be helpful to others
In the onPrepare() event of crosstab you can write the code as given below
function onPrepareCrosstab( crosstab, reportContext )
{
if(some condition ){
reportContext.getDesignHandle().getElementByID(ElementId#).setStringProperty("width","0px");
}
}
here ElementId# is the Id# of the cell you want to hide. As you can see we can also use this to change the width of the cell dymanically.
Try your code in an OnCreateCell event.
I need to make a crosstab column visible or hidden based on a report parameter. How can it be done?
In the onPrepare event of crosstab you can do some thing like this
function onPrepareCell( cell, reportContext ){
if(reportContext.getParameterValue("reportParameter") == something ){
if( cell.getCellID() == cell#){
cell.getStyle().setDisplay("none");
}
}
cell# is the ElementId of the cell you want to hide
Is it possible to render a Grid with one row selected as default (set the right page number and highlight the row)?
For highlighting, try using the "OnRowDataBound" event
.ClientEvents(events => events.OnRowDataBound("onRowDataBound"))
with something like
function onRowDataBound(e) {
var myId = $('#MyId').val();
if (e.dataItem.Id == myId)
e.row.className = 't-state-selected';
}
I'm still trying to figure out how to set the correct initial page number. This bloke might be on to something.
Use the Grid RowAction method, eg:
.RowAction(row => row.Selected = row.DataItem.CustomerCode.Equals(ViewBag.ID))
It is perhaps possible if you iterate in the grid source, locate the row which has to be selected in it, than use a formula to detect on which page will be displayed, and finally change the page index on initial load and select it.