Need help. RowGrouping is rendering an empty group label. How do I fix or hide this?

Need help. RowGrouping is rendering an empty group label. How do I fix or hide this?

comicragecomicrage Posts: 12Questions: 2Answers: 0
edited June 2013 in General
I need some help. I am adding rowGrouping but when the grid is rendered, I get an empty group label, which is labeled "-". I think it has to do with how my asp.net gridview is marked up. Originally, in the first column, I had the following




%# Item.MyValue%>



It threw off the grouping column and the row grouping did not work. I noticed that example used table with td etc. I decided to change it to



%# Item.MyValue%>



The label tag removal got the row grouping working but I get an empty group label "-" with no record. I doubled checked the data and it is fine.

How do I fixed this or hide empty group label from be rendered on the grid.

Below is my JQuery and small sample of the gridview markup code. Any help is appreciated.



@import "../../Content/DataTables-1.9.4/media/css/demo_page.css";
@import "../../Content/DataTables-1.9.4/media/css/demo_table.css";
@import "../../Scripts/DataTables-1.9.4/media/css/themes/base/jquery-ui.css";
@import "../../Scripts/DataTables-1.9.4/themes/smoothness/jquery-ui-1.8.4.custom.css";



.expanded-group{
background: url("../../Images/Minus.png") no-repeat scroll left center transparent;
padding-left: 15px !important
}
.collapsed-group{
background: url("../../Images/plus.png") no-repeat scroll left center transparent;
padding-left: 15px !important
}









$(document).ready(function () {

var oResultGrid = $("[id$='gvReportData']");

if (fixEmptyDataRow(oResultGrid)) {
var oTable = oResultGrid.dataTable({
"bPaginate": false,
"bFilter": false,
"bInfo": false
}).rowGrouping({
bExpandableGrouping: true,

iExpandGroupOffset: -1,
asExpandedGroups: true
});
}
else {
oResultGrid.dataTable({
"sPaginationType": "full_numbers",
"bFilter": false,
"aaSorting": [[1, 'asc']]
}).rowGrouping({
bExpandableGrouping: true,

iExpandGroupOffset: -1,
asExpandedGroups: true
});
}
});


function fixEmptyDataRow(table) {
// Check Contents of 1st TD tag in table. If it contains the EmptyDataRows text, then this is an Empty Data Row
var value = $(table).children('tbody').children('tr').children('td:first').text().trim();
// Prepend THEAD required by JQuery DataTables for the EmptyDataRow Table
if (value == "No results match your query") {
// EmptyDataItems template
table.prepend("");
return true;
}
else
return false;
}










No results match your query




<%# Item.BILLY_CYCLE_DESC %>

Replies

  • psharppsharp Posts: 39Questions: 0Answers: 0
    Are you setting iGroupingColumnIndex?

    i.e.
    var oTable = oResultGrid.dataTable({
    ~table settings~
    })
    .rowGrouping({
    iGroupingColumnIndex : 1,
    bExpandableGrouping : true,
    etc...
    })
  • comicragecomicrage Posts: 12Questions: 2Answers: 0
    Yes. I removed the tag from the 1st column and the grouping is working now. But I am getting an empty Grouping Label. Trying to figure out how to remove it.
This discussion has been closed.