예제 #1
0
        /// <summary>
        /// Set html properties for cell
        /// </summary>
        /// <param name="cellToConfigurate">Cell for setup</param>
        /// <param name="grid">Grid to render</param>
        /// <param name="row">Row to get properties</param>
        /// <returns>Configured header cell</returns>
        private HtmlTableHeaderCell ConfigureHeaderCell(HtmlTableHeaderCell cellToConfigurate, Grid grid, GridRow row)
        {         
            if (row.NonBordered)
            {
                cellToConfigurate.Styles.Add("display:none");
            }

            if (row.ColumnName != null)
            {
                cellToConfigurate.InnerHtml = row.ColumnName;
            }

            if (row.ColumnWidth != 0)
            {
                cellToConfigurate.Styles.Add(string.Format("max-width:{0}px", row.ColumnWidth));
            }

            if (!string.IsNullOrEmpty(row.DataField))
            {
                cellToConfigurate.Attributes.Add(new KeyValuePair<string, string>("data-field", row.DataField));
            }

            if (!string.IsNullOrEmpty(row.ModelField))
            {
                cellToConfigurate.Attributes.Add(new KeyValuePair<string, string>("data-modelfield", row.ModelField));
            }

            if (row.IsSortable)
            {
                cellToConfigurate.Classes.Add("sort-row");
                if (grid.Sorting != null && grid.Sorting.SortColumnName == row.DataField)
                {
                    cellToConfigurate.Classes.Add("current-sort");
                    if (grid.Sorting.LowestToHight)
                    {
                        cellToConfigurate.Classes.Add("sorting_asc");
                    }
                    else
                    {
                        cellToConfigurate.Classes.Add("sorting_desc");
                    }
                }
                else
                {
                    cellToConfigurate.Classes.Add("sorting");
                }
            }

            if (row.IsHidden)
            {
                cellToConfigurate.Styles.Add("display:none");
            }

            return cellToConfigurate;
        }
예제 #2
0
        /// <summary>
        /// Config table cell
        /// </summary>
        /// <param name="cellToConfigurate">Cell for configuration</param>
        /// <param name="row">Contains config properties</param>
        /// <param name="entity">Entity to config column</param>
        /// <returns>Config column</returns>
        private HtmlTableCell ConfigureTableCell(HtmlTableCell cellToConfigurate, GridRow row, object entity)
        {
            cellToConfigurate = row.RenderTemplate.Render(entity);
            if (row.NonBordered)
            {
                cellToConfigurate.Styles.Add("border:none");
            }

            if (row.IsKey)
            {
                cellToConfigurate.Classes.Add("key");
            }

            if (row.ColumnWidth != 0)
            {
                cellToConfigurate.Styles.Add(string.Format("max-width:{0}px", row.ColumnWidth));
                cellToConfigurate.Styles.Add("word-wrap:break-word");
            }

            if (!string.IsNullOrEmpty(row.DataField))
            {
                cellToConfigurate.Attributes.Add(new KeyValuePair<string, string>("data-field", row.DataField));
            }

            if (row.IsHidden)
            {
                cellToConfigurate.Styles.Add("display:none");
            }

            return cellToConfigurate;
        }