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
Ajax pager help #13
Comments
@dthunder746 Hi, thank you for your feedback. According to your question, the problem seems to be caused by the AJAX feature itself, not the pager. Basically, AJAX is just send a HTTP request in background channel and get the response from the server. The AJAX request does not have much differences compared with regular user generated requests. Thus, If you are simply raises a request to a controller action and this action returns a view, the standard MVC processing pipeline will always do all necessary work like inserting layouts and sections, and then the complete page will be sent. The To use a most common and simple solution to this problem, you may change your code as bellow:
Hope it helps, and best wishes :-) |
Hey, thanks for the reply I appreciate the help. So I have modified my action to return a PartialView to the GET request. Inspecting the response using the network tab in chrome dev tools, I can see partial view with the requested data is successfully sent back by the server, but it is now not being inserted into the #results table. I guess I'm still missing something. Any tips? The part of the action that returns the partial view (a bit hacky, but it works)
The section of the view that contains the pager:
The partial view:
|
@dthunder746 Hi, according to my knowledge, the Microsoft Unobtrusive AJAX library uses Hope it helps and best wishes :-) |
Awesome, thanks. After changing that and moving the pager inside the partial view, everything is working perfectly. I noticed that a copy of
I guess this could be a problem if the user paginates enough, so I wrote a small jQuery function to remove these from the links after the ajax request is complete. Thanks for the help mate, you're a legend. |
HI, it seems your problem is caused by http request handling. Your application will display the Anyway, please make a double check for your code and it seems your original problem has been solved. I'm closing this issue and please feel free to reopen it if you have any new question :-) |
@sgjsakura could you please provide me example how to use data-ajax-update ? |
@fityanaula hi, could you provide more information about your problem? Thank you. |
Hey mate, having a bit of an issue using the ajax pagination.
I am trying to do simple table pagination, and I've got it working using direct links, but ajax would be preferable.
I've used the library suggested in the demo and enabled ajax navigation on the pager. If I leave it at that, obviously clicking the pagination buttons results in nothing happening.
I then read issue #8 and experimented with what you suggested there. Upon adding the method and update attributes it kind of worked, however it inserts an updated version of the entire page body it into the specified div. How do I get it to only update the table?
I don't have much experience with ajax, so i'm sure this is relatively simple to fix, so a prod in the right direction would be appreciated!
this is my current pager code:
And the table in my view is something like this:
The text was updated successfully, but these errors were encountered: