Skip to content

Commit

Permalink
X.PagedList.Mvc.Core: Revert behavior for UpdateTargetId
Browse files Browse the repository at this point in the history
This reverts commit 01d9633.

In [1], behavior for the UpdateTargetId was changed so the "#" symbol is
not prepended anymore and one has to add it manually now. However, the very
name "UpdateTargetId" indicates that this is an ID and not something else.
Similar behavior is found for JavaScript, where a function name containing "Id"
implies that the hash symbol is not required.

Revert this to the previous behavior (<= 8.4.7), so it can be used without
changes coming from any version except 9.1.2. This implements the correct
behavior as it implies the provided value is actually an ID.

Future alternate solutions as discussed in #245 might choose different names
to accept arbitrary elements as argument (e.g. UpdateTarget to accept IDs,
classes, etc.).

Note that examples never got updated anyway (and thus no need to revert them).

[1] 01d9633 ("Close #221")

Fixes: #245
  • Loading branch information
adschmu committed Jul 8, 2024
1 parent cf1a5e7 commit f3745d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/X.PagedList.Mvc.Core/AjaxOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ public virtual IEnumerable<HtmlAttribute> ToUnobtrusiveHtmlAttributes()
{
var attrs = new List<HtmlAttribute>
{
new() { Key = "data-ajax-method", Value = HttpMethod },
new() { Key = "data-ajax-mode", Value = InsertionMode },
new() { Key = "data-ajax-update", Value = UpdateTargetId },
new() { Key = "data-ajax", Value = "true" }
new() {Key = "data-ajax-method", Value = HttpMethod},
new() {Key = "data-ajax-mode", Value = InsertionMode},
new() {Key = "data-ajax-update", Value = "#" + UpdateTargetId},
new() {Key = "data-ajax", Value = "true"}
};

if (!string.IsNullOrEmpty(Confirm))
Expand Down
1 change: 0 additions & 1 deletion src/X.PagedList.Mvc.Core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
Library was not updated for a long time. This version contains lot of breaking changes:
- Updated namespaces
- Removed some classes which duplicated ASP.NET Core classes
- UpdateTargetId in AjaxOptions now not automatically prepended
- Other changes

## What is this?
Expand Down

0 comments on commit f3745d8

Please sign in to comment.