Example #1
0
        protected void BaseRenderRowEnd(GridRowViewData <T> rowData)
        {
            bool rendered = GridModel.Sections.Row.EndSectionRenderer(rowData, new RenderingContext(Writer, Context, _engines));

            if (!rendered)
            {
                RenderRowEnd();
            }
        }
Example #2
0
        protected virtual void RenderCellValue(GridColumn <T> column, GridRowViewData <T> rowData)
        {
            var cellValue = column.GetValue(rowData.Item);

            if (cellValue != null)
            {
                RenderText(cellValue.ToString());
            }
        }
        protected override void RenderStartCell(GridColumn <T> column, GridRowViewData <T> rowData)
        {
            string attrs = BuildHtmlAttributes(column.Attributes(rowData));

            if (attrs.Length > 0)
            {
                attrs = " " + attrs;
            }

            RenderText(string.Format("<td{0}>", attrs));
        }
Example #4
0
        private IDictionary <string, object> GetAttributesFromRow(GridRowViewData <T> row)
        {
            var dictionary = new Dictionary <string, object>();
            var pairs      = _attributes.SelectMany(attributeFunc => attributeFunc(row));

            foreach (var pair in pairs)
            {
                dictionary[pair.Key] = pair.Value;
            }

            return(dictionary);
        }
        protected override void RenderRowStart(GridRowViewData <T> rowData)
        {
            var attributes = GridModel.Sections.Row.Attributes(rowData);

            if (!attributes.ContainsKey("class"))
            {
                attributes["class"] = rowData.IsAlternate ? "gridrow_alternate" : "gridrow";
            }

            string attributeString = BuildHtmlAttributes(attributes);

            if (attributeString.Length > 0)
            {
                attributeString = " " + attributeString;
            }

            RenderText(string.Format("<tr{0}>", attributeString));
        }
Example #6
0
        protected virtual void RenderItem(GridRowViewData <T> rowData)
        {
            BaseRenderRowStart(rowData);

            foreach (var column in VisibleColumns())
            {
                //A custom item section has been specified - render it and continue to the next iteration.
                if (column.CustomItemRenderer != null)
                {
                    column.CustomItemRenderer(new RenderingContext(Writer, Context, _engines), rowData.Item);
                    continue;
                }

                RenderStartCell(column, rowData);
                RenderCellValue(column, rowData);
                RenderEndCell();
            }

            BaseRenderRowEnd(rowData);
        }
Example #7
0
        protected virtual void RenderItem(GridRowViewData <T> rowData)
        {
            BaseRenderRowStart(rowData);

            foreach (var column in VisibleColumns())
            {
                //A custom item section has been specified - render it and continue to the next iteration.
#pragma warning disable 612,618
                // TODO: CustomItemRenderer is obsolete in favour of custom columns. Remove this after next release.
                if (column.CustomItemRenderer != null)
                {
                    column.CustomItemRenderer(new RenderingContext(Writer, Context, _engines), rowData.Item);
                    continue;
                }
#pragma warning restore 612,618

                RenderStartCell(column, rowData);
                RenderCellValue(column, rowData);
                RenderEndCell();
            }

            BaseRenderRowEnd(rowData);
        }
Example #8
0
 protected abstract void RenderStartCell(GridColumn <T> column, GridRowViewData <T> rowViewData);
Example #9
0
 protected abstract void RenderRowStart(GridRowViewData <T> rowData);