[Kendo UI] [Kendo UI] Kendo UI grid nested json 처리하는 쉬운 법

2020. 10. 23. 15:39·OLD/Front End
반응형

 


json 포맷 안에 있는 데이터를 추출하려고 할때 nested 된 경우가 있다.

이런 경우에 대한 것을 이전에 포스팅을 했었지만..

설명을 더 찾아본 결과 더욱 쉬운 방법이 있어서 추가적으로 포스팅한다.

 

우선 kendo grid 의 schema 파라미터 안에는 ' data ' 라는 파라미터가 있다.

이 파라미터는 특정 key의 안에 value 값들을 추출해주는 역할을 한다.

 

schema: {
   data: "data",
   total: "total"
   }
   
   

 

schema 의 data 파라미터에 추출할 값이 들어있는 key 값을 써넣고 kendoGrid 의 column 에 추출할 

key 값의 key를 써주면 자동으로 key 값의 value 를 추출해준다

 

전체 코드는 아래와 같다.

var dataSource = new kendo.data.DataSource({
	type: "jsonp",
	transport:{
		read: {
        	# 자신이 가져오고자 하는 특정 경로
			url : "http://localhost:8080/haha/getLst.json"
		}
		},
		schema: {
			data: "Lst"
			}
	});
				
				
				
$("#tbs1").kendoGrid({
	dataSource: dataSource,
	serverPaging: true,
	serverSorting: true,
	ServerFiltering: true,
	serverAggregates: true,
	pageable:{
		refresh: true,
		pageSizes: true
	},
	scrollable: true,
	columnMenu: false,
	columns:[
		{field:"id", title: '번호'}, 
		{field:"view_cnt", title: '조회수'}, 
		{field:"reg_ts", title: '작성일'}, 
		{field:"title", title: '제목'}
		]
	});
}

이런식으로 한다면 for 문을 쓰거나 이전에 서술했던 것 처럼 복잡하게 

json value 값을 추출할 필요가 없을 것이다

 

 

참고 링크

demos.telerik.com/kendo-ui/grid/grouppaging

 

Group paging of remote data in jQuery Grid Widget Demo | Kendo UI for jQuery

The group paging feature of the Kendo UI for jQuery Grid allows you to page through groups and load the group items on demand. Loading of the group items happens when a group is expanded. Group paging works with both local and remote data. This demo presen

demos.telerik.com

 

반응형

'OLD > Front End' 카테고리의 다른 글

[Kendo] kendo grid 내의 데이터 클릭시 해당 링크로 이동 template 사용  (0) 2020.10.26
[Kendo UI] [Kendo UI] Kendo UI grid 의 selectedKeyNames( ) 파라미터 사용  (0) 2020.10.26
[Kendo UI] Kendo UI grid json 포멧 처리하는 법  (0) 2020.10.23
[Kendo UI] Kendo UI grid data source 하는 법과 주의할 것  (1) 2020.10.22
[Kendo UI 설치] kendo UI 데모 버전 초기 설치 및 적용 방법 in Spring  (2) 2020.10.07
'OLD/Front End' 카테고리의 다른 글
  • [Kendo] kendo grid 내의 데이터 클릭시 해당 링크로 이동 template 사용
  • [Kendo UI] [Kendo UI] Kendo UI grid 의 selectedKeyNames( ) 파라미터 사용
  • [Kendo UI] Kendo UI grid json 포멧 처리하는 법
  • [Kendo UI] Kendo UI grid data source 하는 법과 주의할 것
쟈누
쟈누
Ad astra per aspera
    반응형
  • 쟈누
    쟈누의 기록공간
    쟈누
  • 전체
    오늘
    어제
    • 분류 전체보기 (444)
      • AWS (31)
        • Glue (4)
        • S3 (1)
      • 클라우드 (0)
      • Data Engineering (37)
        • GitHub (10)
        • NiFi (11)
        • Spark (10)
        • Snowflake (0)
        • 머신러닝, AI (6)
      • 언어 (118)
        • 데이터 베이스 (42)
        • JAVA (9)
        • Python (34)
        • Java Script (15)
        • Linux (18)
      • 프로젝트, 인강 그리고 책 (30)
        • Spotify Project (7)
        • RASA chatbot Project (9)
        • Naver shopping Project (6)
        • 빅데이터를 지탱하는 기술 (8)
      • OLD (56)
        • IT 용어 사전 (13)
        • Front End (12)
        • Back End (31)
      • Error code 모음 (165)
        • 1. SQL errors (17)
        • 2. Hadoop errors (20)
        • 3. Linux Errors (14)
        • 4. Python errors (33)
        • 5. JAVA, Spring errors (41)
        • 6. Jav Script errors (10)
        • 7. Dev Tools errors (9)
        • 8. Git errors (8)
        • 9. Jenkins Errors (4)
        • 10. airflow Errors (2)
        • 11. Aws errors (7)
      • 개인 (1)
        • 책 (1)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
    • 블로그 관리
    • 글쓰기
  • 링크

  • 공지사항

    • 간단한 블로그 소개
  • 인기 글

  • 태그

    json
    error
    Git
    linux
    MySQL
    SQL
    NiFi
    python error
    리눅스
    Python
    파이썬
    Spring
    에러
    자바
    AWS
    API
    install
    java
    node
    설치
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
쟈누
[Kendo UI] [Kendo UI] Kendo UI grid nested json 처리하는 쉬운 법
상단으로

티스토리툴바