GithubHelp home page GithubHelp logo

abhimjoshi / mvc-infinite-scroll-grid Goto Github PK

View Code? Open in Web Editor NEW

This project forked from philoushka/mvc-infinite-scroll-grid

0.0 2.0 0.0 6.19 MB

Scrollable grids, lists, and divs in ASP.NET MVC

C# 59.68% CSS 2.48% ASP 0.51% JavaScript 15.45% Pascal 21.88%

mvc-infinite-scroll-grid's Introduction

MVC Infinite Scroll Grid

Here is a demonstration of a way to add infinite scrolling to a grid, table, or any other HTML element in an ASP.NET MVC project.

###Demo - Try Out Infinite Scrolling###

Use this by:

  • copying the code here from GitHub
  • clone the repo for yourself
  • add it to your project via NuGet

How Does This Work?

  • On the first hit to the page/URL, you grab all the data that could/would be displayed in this table. It doesn't even have to be a table with rows and columns. It could be any HTML that logically repeats.
  • This data is saved to session.
  • The first n entries are rendered to the view.
  • When the user scrolls to the bottom of the page in their browser, the page sends an AJAX request back to a controller method for another batch.
  • The controller takes the current 'page' number, and gets the next n entries from session.
  • A partial view is rendered and returned back as HTML back to the browser
  • The browser appends the rendered HTML to the page.

Tweak You Might Want

  • Use Cache[] instead of Session[]. If your data doesn't need to differ between users, you can use Cache["Customers"] with System.Web.Caching. This is useful if you want to keep your memory profile on the server low, the amount and type of data you're scrolling through, etc.

Pull Requests

I welcome your pull requests. Please submit your PR in a branch named for the feature/fix that you're introducing (i.e. not master).

Authors

Phil Campbell and other contributors. Contact me by creating a new issue on the repo, or by Twitter

Licensing

MIT License

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.