Skip to content

Commit

Permalink
Added error message for DataPager when Visible is set
Browse files Browse the repository at this point in the history
  • Loading branch information
exyi committed Apr 10, 2019
1 parent 4e7fe57 commit d804e5c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/DotVVM.Framework/Controls/DataPager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using DotVVM.Framework.Compilation.ControlTree;
using DotVVM.Framework.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;

namespace DotVVM.Framework.Controls
{
Expand Down Expand Up @@ -272,6 +273,8 @@ protected override void AddAttributesToRender(IHtmlWriter writer, IDotvvmRequest
// If Visible property was set to something, it will be overwritten by this. TODO: is it how it should behave?
if (HideWhenOnlyOnePage)
{
if (IsPropertySet(VisibleProperty))
throw new Exception("Visible can't be set on a DataPager when HideWhenOnlyOnePage is true. You can wrap it in an element that hide that or set HideWhenOnlyOnePage to false");
writer.AddKnockoutDataBind("visible", $"ko.unwrap({GetDataSetBinding().GetKnockoutBindingExpression(this)}).PagingOptions().PagesCount() > 1");
}
}
Expand Down

0 comments on commit d804e5c

Please sign in to comment.