asp.net - Unable to update jQuery mCustomScrollbar -


i'm using custom scrollbar http://manos.malihu.gr/jquery-custom-content-scroller/ .

i'm using on div contains gridview. when new row added gridview, , exceeds size, scroll bars not being displayed.

and have issue there div within , i'm using button toggle display of div.

i'm unable update scrollbar

(function($) { $(window).load(function() {  $("#rightfixed").mcustomscrollbar({ scrollinertia: 150, autohidescrollbar: true, updateonbrowserresize: true, updateoncontentresize: true, theme: "dark-2"  }); }); })(jquery);  $(function () { $("#showtax").click(function () { $("#carttaxdiv").slidetoggle(); $(this).text($(this).text() == 'show tax' ? 'hide tax' : 'show tax'); $('#rightfixed').mcustomscrollbar("update"); }); }); 

one thing scrollbar initialization event in $(window).load , button click in $(document).ready.

can me ??

i've figured out solution.

for slidetoggle, have place update in function , call in toggle. ie call function when toggle completed.

function updatescrollbar() {     $('#rightfixed').mcustomscrollbar("update"); }  $("#showtax").click(function () {     $("#carttaxdiv").slidetoggle(updatescrollbar); // call update scrollbar after sliding done.     $(this).text($(this).text() == 'show tax' ? 'hide tax' : 'show tax'); }) 

so toggle problem solved.

coming second problem - gridview. when grodview being updated, scrollbar has updated.so this, have call function on every postback. i'm not using update panel here i'll call function if postback in pageload.

if (ispostback) { page.clientscript.registerstartupscript(this.gettype(), "myscript", "updatescrollbar();", true); } 

hence problems solved.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -