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 |