Skip to content

Append unobtrusive ajax url generator (attribute data-ajax-url)#78

Open
NatanMakarov wants to merge 1 commit intotroygoode:masterfrom
NatanMakarov:master
Open

Append unobtrusive ajax url generator (attribute data-ajax-url)#78
NatanMakarov wants to merge 1 commit intotroygoode:masterfrom
NatanMakarov:master

Conversation

@NatanMakarov
Copy link

Sometimes required to perform ajax queries to a different url address. It requires tag attribute "data-ajax-url".
I changed the helper methods for this feature (leaving backward compatibility):

Using helper method in view:
@Html.PagedListPager(
    Model,
    page => Url.Action("Index", new { page, size = Model.PageSize }),
    page => Url.Action("Items", new { page, size = Model.PageSize }), // Unobtrusive ajax url generator
    PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing("containerId")
);

Result markup:
<a href="/users/page-2" data-ajax-url="/users/items?page=2&size=25" data-ajax-...>2</a>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant