Notice
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- 모뉴먼트
- jQuery
- 핑크
- 잡담
- Pink
- 강추
- 모뉴먼트 밸리
- 레고
- 가사
- 영화
- 아이패드
- 추천
- 카이로소프트
- 감상
- 게임
- 후기
- JavaScript
- Monument Valley
- 아이폰게임
- great forest
- 아이러브니키
- 유료
- php
- 아이폰
- 공략
- Monument
- goblin sword
- 맛집
- 시사회
- 일상
Archives
- Today
- Total
잡담소장소
[jQuery] bootstrap table sort 문제 본문
bootstrap-table 사용 시, sidePagination 값을 server로 둘 경우 sort 하지 않는다!
그래서 처음 생성 시 sortName, sortOrder를 줘도 의미가 없다-_-;
SQL에 order by 를 넣어서 반환받은 값을 돌려주도록 하자..
ajax로 데이터를 가져와서 넘겨주면 load 함수가 실행된다
BootstrapTable.prototype.load = function (data) { var fixedScroll = false; // #431: support pagination if (this.options.sidePagination === 'server') { this.options.totalRows = data.total; fixedScroll = data.fixedScroll; data = data[this.options.dataField]; } else if (!$.isArray(data)) { // support fixedScroll fixedScroll = data.fixedScroll; data = data.data; } this.initData(data); this.initSearch(); this.initPagination(); this.initBody(fixedScroll); };
initData함수에서 sidePagination 값을 체크해서 initSort 실행 여부를 제어한다
return 을 지워도 되지만 서버에서 정렬된 데이터를 보내주면 문제 없다
sortable을 사용한 client 제어가 필요하다면 풀어야할지도...(이 부분은 테스트하지 않음)
BootstrapTable.prototype.initData = function (data, type) { if (type === 'append') { this.data = this.data.concat(data); } else if (type === 'prepend') { this.data = [].concat(data).concat(this.data); } else { this.data = data || this.options.data; } // Fix #839 Records deleted when adding new row on filtered table if (type === 'append') { this.options.data = this.options.data.concat(data); } else if (type === 'prepend') { this.options.data = [].concat(data).concat(this.options.data); } else { this.options.data = this.data; } if (this.options.sidePagination === 'server') { return; } this.initSort(); };
이거 찾으려고 삽질한거 생각하믄..ㅠㅠ 에휴
반응형
'Study ;3' 카테고리의 다른 글
[Javascript] a href를 통해 다운로드 시 beforeunload 이벤트 이슈 (0) | 2019.09.27 |
---|---|
[Angular2] Component in Another Component (0) | 2019.08.01 |
[JAVA] inner function의 AOP 호출 (0) | 2018.02.07 |
[JAVA] spring에서 직접 파일 다운로드 (0) | 2018.01.18 |
[JAVA] 암호걸린 엑셀 이메일로 전송 (0) | 2018.01.18 |
Comments