본문 바로가기

개발/ETC

[jqGrid] 그리드 내 페이징 시 scrollTop

 

그리드 안에서 페이징 시 스크롤을 제일 위로 올려야 한다...!!

 

처음에는 

stackoverflow.com/questions/39479275/how-to-make-jqgrid-scroll-to-top-when-going-to-next-page

 

How to make jqgrid scroll to top when going to next page?

I have a grid that when the page is changed the scrollbar is still at the bottom of the grid. Is there a property in the jqgrid for it to automatically scroll back to the top of the grid. Here are...

stackoverflow.com

이 페이지를 참고해서 

그리드 그리는 부분에서 (ex. $("#jqGrid").jqGrid({ .... }) )

onPaging: function(){

}, 

에다가

var ids = mygrid.jqGrid("getDataIDs");

mygrid.jqGrid("setSelection", ids[0]);

mygrid.closest(".ui-jqgrid-bdiv").scrollTop(0);

를 넣었더니

그리드의 이전 리스트가 번쩍 거리고 다시 원래대로 바뀌는 

이상한 현상을 보았다...

 

그래서 기존에 setSelection 하고 있던

GridComplete: function(){

}, 

에다가 넣었더니 잘 된다

 

 

어떤 분은 

loadComplete: function(){

},

에다가 넣어서 하셨다

m.blog.naver.com/PostView.nhn?blogId=ensof&logNo=220957087997&proxyReferer=https:%2F%2Fwww.google.com%2F

 

jqGrid 스크롤하기

페이징을 사용하지 않고 조회결과가 한 화면을 넘어가면 세로 스크롤이 생기는데, 스크롤이 맨 아래로 내려...

blog.naver.com

 

 

참고로

var mygrid = $("#jqGrid"); 이고

.ui-jqgrid-bdiv는 jqgrid가 그려지고 나서 리스트가 뿌려지는 class명이다

 

 

gridComplete와 loadComplete의 차이점은 아래 링크에서 확인 가능하다

areumtb.tistory.com/87

 

jqgrid loadComplete , gridComplete

gridComplete grid 가 모든 작업을 완료한 후 발생한다. loadComplete 서버에 요청을 보낸 직후 호출된다

areumtb.tistory.com

 

반응형