How do I hide a row in BIRT? - report

I have a data table with 2 detail rows. In certain cases I want to show the first detail row and in some cases I want to show the 2nd. Something like:
if (row["field"] == "N") {
hideRow1();
}
else {
hideRow2();
}

In the layout tab in BIRT Report Designer, select the first detail row (so that it is higlighted).
In the Properties tab of the Property editor for the row, select the Visibility section:
Check the Hide Element checkbox;
Click the fx button next to the Expression, and enter a formula like: row["field"] == 'N'.
Repeat the process for the second detail row with a formula like: row["field"] != 'N'.

Related

Extjs4 how to disable itemClick event of grid's certain column

I am working in extjs4. I have grid panel view as=
i want to show image in floating window whenever user clicks on grid row.So i have written function namely showImage() and calling it as=
me.mon(me, {'itemclick' : me.showImageViewer
}, me);
But i dont want to call this function when user clicks on FileName column of grid. So how to restrict calling showImage function when user clicks on grid column 'FileName'
You can listen to the column click function. Define common listener for columns you need. In arguments you should recieve grid, cell element, row index, column index, event data and record(in such order). So if you'll move, rename headers or do whatever you want with column with such listener it wouldn't change click listener.
i want to show image in floating window whenever user clicks on grid row.
Do you mean you'll show a popup containing the bigger image if image on row is clicked? if yes, on your showImageViewer function, you have to check the attributes of the cell if it's an image or you can check its dataIndex.
You can also listen to cellClick instead of itemClick. With that, you can check the cellIndex of the cell being clicked. In your case, if cellIndex is equal to 2 (index of your FileName column, don't call showImageViewer.
cellClick : function(view, cell, cellIndex, record, row, rowIndex, e) {
}
You can use a css selector to differentiate between elements inside the row, using a code like the following
listeners: {
itemclick: {
fn: function (view, record, item, index, e, eOpts) {
var photo = e.getTarget('.photo');
if(photo) {
alert(record.get('photo'));
}
}
}
You can try a working sample here. Hope it helps to solve your problem

Disable selection on first column of grid

Is there a way to disable selection on the first column of a grid only. I have 2nd and 3rd column as 'checkcolumn', which fires selection for that row. That's why I cannot entirely use
disableSelection: true
on the grid, because this would disable the selection fire event on checkboxes. The first column is just a text, and I don't want selection of that row when the first column's row is clicked.
Any help?
The beforeitemmousedown event will probably work for you, add it as a listener where you declare your grid and return false when the event's target is the first cell in the row:
listeners: {
beforeitemmousedown: function(view, record, item, index, e, eOpts)
{
if(item.cells[0] == e.target.parentElement)
return false;
}
}

how to get the selected Options Value from the Table in Asp.net?

I have dynamically created a table in asp.net and Each cell in a row contains Option Button and Text Box respectively.The Option Buttons in a row are grouped.So,Only one Option Button Can be selected in a row.My Table contains m columns and n rows.
Now i want to get the selected Option Button value in each row when the form is submitted.
Above Table Contains 3 rows and 4 columns.
row :1 -> contains header.
row :2 ->[2,0] is a option button,[2,1] is a text box,[2,2] is a Option,[2,3] is Text Box
.
.
.
Last Row -> is a sumbit button.
So Now i want to get the selected options button value of each row when submit button is pressed.
Please guide me to get out of this issue...
Try something like this
Note: Here tbl is an instance of HtmlTable control
foreach (TableRow row in tbl.Rows)
{
foreach (TableCell cell in r.Cells)
{
RadioButton r = c.FindControl("radiobuttonID");
// find your radiobutton & get needed values from that
}
}

Clicking on a link in a table

I have a table of four columns. The data in the first column is a name of a group in which I can click on to go to a new page to modify the group data.
I can get the text of that group name, but I am unable to click on it. I'm trying to go through each row and get the status of each group (located in column 4). If it's on hold, I want to modify the data of that group.
Here is my code: Why will it not click on the group name?
List<WebElement> elems = driver.findElements(By.xpath("//table[#id='nameOfTable']/tbody/tr"));
for (WebElement rowElem : elems)
{
List<WebElement> cells = rowElem.findElements(By.xpath("td"));
if(cells.get(3).getText().equalsIgnoreCase("Hold"))
{
System.out.println(cells.get(0).getText()); //
cells.get(0).click; // This will not click on the link
}
}
It is because you are clicking the whole cell, not the link inside the cell. Try:
cells.get(0).findElements(By.TagName("a")).Click();
If the link is an <a> tag it will work, but you can use id, classname, etc... if it isn't.
You would need to say cells.get(0).click();.
I believe you are missing a couple of parentheses...

Getting Checked rows from gridview in asp.net

I have a GridView in ASP.net where I have a CheckBox column. The user can toggle the CheckBox. Now, what I want is that when the user clicks on a button, all the records from the GridView where the CheckBox is checked should be displayed. And on another button, the opposite state should be displayed...
I am not getting the logic for the same.
Can anyone please help me with the logic..
You could iterate through the GridViewRows and check if the CheckBox is checked using something like the following
Edit from comments, fixed small bugs. Thanks guys. (3/20/2013):
foreach (GridViewRow row in yourGridViewID.Rows)
{
CheckBox check = (CheckBox)row.FindControl("CheckBoxName");
if (check.Checked)
{
//Take Row information from each column (Cell) and display it
}
else
{
//Display in seperate area
}
}
The index is going to be the column number starting from 0, going left to right of which column holds the CheckBox. You need to make sure the CheckBox has an ID name which is used at CheckBoxName. If you don't have an ID for that, you can also use
CheckBox check = (CheckBox)row.Cells[index].Controls[0];

Resources