Thursday, June 27, 2019

Load data on Scroll in MVC | EASY & Tested


ALTER PROCEDURE YourProcedure
    @Skip INT = NULL,
    @Take INT = NULL
AS
BEGIN

    IF @Skip IS NULL
        SET @Skip = 0

    IF @Take IS NULL
        SET @Take = 50

    SELECT
        YourColumn
    FROM
        YourTable
    ORDER BY
        SomeColumn
    OFFSET 
        @Skip ROWS 
    FETCH NEXT 
        @Take ROWS ONLY 

END
 $('.stContainer').on('scroll', chk_scroll);
function chk_scroll(e) {
    var currSkip = parseInt($('.stContainer').length);
    if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight) {
        GetDetails(currSkip);
    }   
    return false;
}
var _prevSkips = -1;
function GetDetails(currSkip) { 
    currSkip = (currSkip == undefined || currSkip == null || currSkip == '' || currSkip == true) ? 0 : currSkip;
    if (currSkip != _prevSkips) {
        _prevSkips = currSkip;
...............
.............
..........

}

No comments:

Post a Comment

javascript Filter/index off

 var family = [{"name":"Jack",  "age": 26},               {"name":"Jill",  "age"...