This is a migrated thread and some comments may be shown as answers.

[Solved] Removing and hiding in row

2 Answers 23 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Madzie
Top achievements
Rank 1
Madzie asked on 14 Feb 2013, 04:41 AM

Hello,
Here are 2 requirements that doesn't seem to work perfect for me: need help plz !
1. For a row, that has column- Id < 1, it should display column[0] value & span this column's value to 7 columns, and if other columns have any value, it should clear it out.
2.If the showRow=false, hide that row

I wrote the below to achieve the above 2 requirements,
DataRowDataBound:
function (e) {

var dataItem = e.dataItem;

if (dataItem && (dataItem.Id< 1))

{

$(e.row.cells[0]).attr('colspan', 7);

}

if (!dataItem.showRow)

dataItem.hide();

}
Requirement 1, works partially as it displays other column values also say like 4th column displays "xyz" 
Requirement 2 is not achieved. 

2 Answers, 1 is accepted

Sort by
0
Accepted
Petur Subev
Telerik team
answered on 18 Feb 2013, 03:55 PM
Hello Varsha,

What exactly is the issue with approach one? Basically if you set colspan you will will need to remove the other rows.
e.g.
if (dataItem && (dataItem.Id< 1))
{
$(e.row.cells[0]).attr('colspan', 7);
$(e.row.cells[0]).nextAll().remove();
}
Regarding hiding the row - there is not such hide() method.
You can try to hide the row with jQuery:
$(e.row).hide();

I hope this helps.

Kind Regards,
Petur Subev
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
0
Madzie
Top achievements
Rank 1
answered on 18 Feb 2013, 06:40 PM
Thanks. It works.
Tags
Grid
Asked by
Madzie
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Madzie
Top achievements
Rank 1
Share this question
or