Skip to content

Commit

Permalink
Merge pull request #626 from riganti/GridViewExtensibility
Browse files Browse the repository at this point in the history
GridView - extensibility
  • Loading branch information
tomasherceg authored Aug 13, 2018
2 parents 0a05871 + bf0cd09 commit 9b872fa
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/DotVVM.Framework/Controls/GridView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ protected internal override void OnPreRender(Hosting.IDotvvmRequestContext conte
DataBind(context); // TODO: support for observable collection
base.OnPreRender(context);
}

private void DataBind(IDotvvmRequestContext context)
{
Children.Clear();
Expand All @@ -176,7 +176,8 @@ dataSource is ISortableGridViewDataSet sortableSet && sortableSet.SortingOptions
sortOptions.SortDescending = false;
}
(sortableSet as IPageableGridViewDataSet)?.GoToFirstPage();
} :
}
:
SortChanged;

// WORKAROUND: DataSource is null => don't throw exception
Expand All @@ -187,7 +188,8 @@ dataSource is ISortableGridViewDataSet sortableSet && sortableSet.SortingOptions
};
}

CreateHeaderRow(context, sortCommand);
var header = CreateHeaderRow(context, sortCommand);
Children.Add(header);
var index = 0;
if (dataSource != null)
{
Expand Down Expand Up @@ -223,10 +225,9 @@ dataSource is ISortableGridViewDataSet sortableSet && sortableSet.SortingOptions
}
}

private void CreateHeaderRow(IDotvvmRequestContext context, Action<string> sortCommand)
protected virtual HtmlGenericControl CreateHeaderRow(IDotvvmRequestContext context, Action<string> sortCommand)
{
head = new HtmlGenericControl("thead");
Children.Add(head);

var gridViewDataSet = DataSource as IGridViewDataSet;

Expand Down Expand Up @@ -257,6 +258,8 @@ private void CreateHeaderRow(IDotvvmRequestContext context, Action<string> sortC
column.CreateFilterControls(context, this, cell, gridViewDataSet);
}
}

return head;
}

private static void SetCellAttributes(GridViewColumn column, HtmlGenericControl cell, bool isHeaderCell)
Expand Down Expand Up @@ -493,7 +496,7 @@ protected override void AddAttributesToRender(IHtmlWriter writer, IDotvvmRequest
base.AddAttributesToRender(writer, context);
}



public override IEnumerable<DotvvmBindableObject> GetLogicalChildren()
{
Expand Down

0 comments on commit 9b872fa

Please sign in to comment.