public override void RenderGroupTableRow(KeyValuePair <string, IGridColumn <TModel> >[] groupColumns, IGroupingItem groupItem, bool alternate, int columnCount, IGridGroupOptions groupOptions, bool empty = false)
        {
            var groupKeys = groupItem != null
                ? HtmlHelper.AnonymousObjectToHtmlAttributes(groupItem.Key)
                : new RouteValueDictionary();

            Writer.Write(alternate ? "<tr class=\"alternate\">" : "<tr>");
            if (empty)
            {
                Writer.Write("<td class=\"hierarchy-cell\">&nbsp;");
            }
            else
            {
                Writer.Write("<td class=\"hierarchy-cell\"><a class=\"grid-icon {0} plus lazy\"></a>", ExpandGroupClass);
            }
            Writer.Write("</td>");
            Writer.Write("<td class=\"grid-group-row\" colspan=\"{0}\">", columnCount + 1);

            if (empty)
            {
                Writer.Write("&nbsp;");
            }
            else
            {
                for (var i = 0; i < groupColumns.Length; i++)
                {
                    var column       = groupColumns[i];
                    var propertyName = String.Format("Key{0}", i);
                    var value        = groupKeys[propertyName];
                    groupOptions.GroupKey[column.Key] = value != null?value.ToString() : null;

                    var columnTitle = column.Value.Title;
                    if (column.Value.GroupTitleRender != null && value != null)
                    {
                        value = column.Value.GroupTitleRender(value);
                    }
                    Writer.Write(GridModel.GridRenderOptions.GroupTitleTemplate, columnTitle, value ?? GridRenderOptions.EmptyGroupTitleText);
                }

                Writer.Write(GridModel.GridRenderOptions.GroupCountTemplate, groupItem != null ? (int?)groupItem.Count : null);
            }

            Writer.Write("</td>");
            Writer.Write("</tr>");

            Writer.Write("<tr style=\"display:none;\"><td class=\"hierarchy-cell\"></td>");
            Writer.Write("<td class=\"grid-group-row\" colspan=\"{0}\">", columnCount);
            RenderGroupGridState(groupOptions);
            Writer.Write("</td>");
            Writer.Write("<td class=\"hierarchy-cell-right\"></td></tr>");
        }
Example #2
0
 public abstract void RenderGroupTableRow(KeyValuePair <string, IGridColumn <TModel> >[] groupColumns, IGroupingItem groupItem, bool alternate, int columnCount, IGridGroupOptions groupOptions, bool empty = false);