Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hi #11

Closed
foladi opened this issue Feb 7, 2021 · 1 comment
Closed

hi #11

foladi opened this issue Feb 7, 2021 · 1 comment

Comments

@foladi
Copy link

foladi commented Feb 7, 2021

Hello and thank you. The question that is at your service is that if we want to enclose each script page in MvcPagedList.Core after loading ajax, where should we proceed? Thank you.
قای شیربندی با سلام وتشکر سوالی که خدمتتان اینست که اگر بخواهیم در MvcPagedList.Core بعد از لود ajax هر صفحه اسکریپتی را اچرا کنیم کجا باید اقدام کنیم.ممنون

@hamed-shirbandi
Copy link
Owner

Sorry to answer too late but maybe it will be used by someone.
You just need to use data-ajax html attribute in ajaxAttributes parameter.
Consider that you must replace '-' in the table below with '_' in the code.
So you can have something like this:


@PagedList.Pager(actionName: "search", controllerName: "home",areaName:"",
    routeValues: new
    {
        term = Context.Request.Query["term"],
        sortOrder = Context.Request.Query["sortOrder"],
        sortBy = Context.Request.Query["sortBy"],

    },
    ajaxAttributes: new 
    {
        data_ajax = "true",
        data_ajax_loading = "#global-ajax-loading",
        data_ajax_update = "#ajax-show-list",
        data_ajax_method = "GET",
        data_ajax_mode = "replace",

        //Add this line to call your js function  <<----------LOOK-----------
        data_ajax_success  = "MyFunction(data)"
        

    },
    pagerOptions: new PagerOptions
    {
        currentPage = (int)ViewBag.CurrentPage,
        PageCount = (int)ViewBag.PageSize,
        TotalItemCount = (int)ViewBag.TotalItemCount,
        DisplayMode = PagedListDisplayMode.IfNeeded,
        DisplayInfoArea = true,
        LinkToNextPageFormat = "next",
        LinkToPreviousPageFormat = "prev",
        CurrentLocationFormat = "page",
        PageCountFormat = "of",
        TotalItemCountFormat = "total count",
        GetStyleSheetFileFromCdn=true,
    } )

data-ajax attributes

 HTML attribute   AjaxOptions 
 data-ajax-confirm   Confirm 
 data-ajax-method   HttpMethod 
 data-ajax-mode   InsertionMode 
 data-ajax-loading-duration   LoadingElementDuration 
 data-ajax-loading   LoadingElementId 
 data-ajax-begin   OnBegin 
 data-ajax-complete   OnComplete 
 data-ajax-failure   OnFailure 
 data-ajax-success   OnSuccess 
 data-ajax-update   UpdateTargetId 
 data-ajax-url   Url 

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

No branches or pull requests

2 participants