Scrolling Position

Scrolling Position

imarjunimarjun Posts: 2Questions: 1Answers: 0

Hello,

I'm using the datatable here, http://dnses.net/project88751/test.php?c=1
JS File : http://dnses.net/project88751/js/customer_appointment.js
Datatable Code Start From Line 223 in JS file

  1. I want to, when page load, Scrolled to bottom of page, and when edit the record, then after reload of page, scroll to that position it was before.
    For this I'm using Global ScrollPosition = 0, (Line No 26) so when page load, if its zero, then use this to scroll down to bottom of page,

From Line 259
if(ScrollPosition == 0)
{
ScrollPosition = $('.dataTables_scrollBody').get(0).scrollHeight;
}
$('.dataTables_scrollBody').scrollTop(ScrollPosition);

And when I edit the row, I save the scroller position to ScrollPosition variable (Line No 451) , and then scroll the page to that position after reload,
So my question is that this kind of approach is good or anything else can be done which is good in speed and performance.

  1. What if I'm only able to replaced only a row that I updated without refreshing whole table. So what the way to access and replaced only that row data.
  2. Also when the page load, and in datatable showing processing data, a zero showing. with element class dts_label why it s appearing, let me know how to avoid this to show. For workaround, in other pages I used css to hide this label.

Thanks in advance.

Arjun,

Answers

  • allanallan Posts: 63,210Questions: 1Answers: 10,415 Site admin

    Hi Arjun,

    The dts_label element is used to show the end user the display row number when they are using the scrollbar (click and drag) to scroll through the data set. You can see that in action here.

    If it isn't working for you, please link to a page showing the issue.

    Thanks,
    Allan

  • imarjunimarjun Posts: 2Questions: 1Answers: 0

    Ohk,.
    Scrollbar showing the some record number when I'm trying to scroll down,.
    But check, When I load the table I want to scroll to bottom after load, So use init complete and use
    initComplete: function(settings, json) { var api = new $.fn.dataTable.Api( settings ); json.recordsFiltered = json.recordsFiltered - 1; api.scroller.toPosition( json.recordsFiltered ); },
    But when I'm using this, After load, scroller get to bottom position, and quickly its goes up.
    Check here, After load its goes up from bottom.

    http://dnses.net/project88751/testD.php

  • allanallan Posts: 63,210Questions: 1Answers: 10,415 Site admin

    Could you try disabling the images please? I suspect it might be related to the extra height being added by them when they are loaded.

    Thanks,
    Allan

This discussion has been closed.