본문 바로가기
jQuery

json data parsing, clone

by 캡틴노랑이 2016. 10. 25.
반응형
다음과 같은 json data를 합치고 싶을 때 
$.extend(true, rowColor, generalGreenSkin); 을 사용 하면 된다. 

이 방법 말고도 꼼수로으로 문자열 변환 후 다시 파싱하는 방법 또한 있다.

var skin =JSON.parse(JSON.stringify(generalGreenSkin));


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var generalGreenSkin= {
    "grid": {
        "background": "#ffffffff", "paddingRight": "2", "iconLocation": "left", "border": "#ffe1e1e1,1", "selectedForeground": "#ffffffff", "iconAlignment": "center", "foreground": "#ff000000", "inactiveForeground": "#ff808080", "iconOffset": "0", "textAlignment": "near", "selectedBackground": "#ff696969", "lineAlignment": "center", "inactiveBackground": "#ffd3d3d3", "selectionDisplay": "mask", "hoveredMaskBorder": "#335292f7,1", "iconPadding": "2", "hoveredMaskBackground": "#1f5292f7", "contentFit": "auto", "paddingTop": "2", "figureBackground": "#ff000000", "paddingBottom": "2", "iconIndex": "0"
    },
    "panel": {
        "background": "#ffededed", "iconLocation": "left", "border": "#ff000000,0", "iconAlignment": "center", "borderBottom": "#ff367b81,1", "fontFamily": "맑은 고딕", "iconPadding": "2", "selectedBackground": "#ff696969", "contentFit": "auto", "inactiveBackground": "#ffd3d3d3", "iconOffset": "0", "selectionDisplay": "mask", "hoveredMaskBackground": "#1f5292f7", "fontSize": "11", "hoveredMaskBorder": "#335292f7,1", "figureBackground": "#ff000000", "paddingBottom": "5", "paddingTop": "4", "paddingRight": "2", "selectedForeground": "#ffffffff", "foreground": "#ff80907a", "inactiveForeground": "#ff808080", "textAlignment": "near", "lineAlignment": "center", "borderRight": "#ff367b81,0", "iconIndex": "0"
    },
    "body": {
        "background":"#ffffffff","paddingRight":"2","iconLocation":"left",
        "selectedForeground":"#ffffffff","iconAlignment":"center",
        "foreground":"#ff333333","inactiveForeground":"#ff808080",
        "borderBottom":"#ffe1e1e1,1","line":"#ffe1e1e1,1","textAlignment":"near",
        "selectedBackground":"#ff696969","lineAlignment":"center","inactiveBackground":"#ffd3d3d3",
        "iconOffset":"0","selectionDisplay":"mask","hoveredMaskBorder":"#335292f7,1",
        "iconPadding":"2","hoveredMaskBackground":"#1f5292f7","contentFit":"auto","paddingTop":"2",
        "borderRight":"#ffe1e1e1,1","figureBackground":"#ff000000","paddingBottom":"2","iconIndex":"0",      
    }
}
 
var rowColor = { body: {dynamicStyles: [{criteria: ["values['DiffTotCost'] = 0"],styles: ["background=#55ff0000"]}], rowStylesFirst: true}};
 
var cloneJson  = $.extend(true, rowColor, generalGreenSkin);





반응형

'jQuery' 카테고리의 다른 글

radio button 라디오 버튼  (0) 2016.11.10
json data에서 조건에 맞는 row 찾기  (0) 2016.10.25
JSON 관련  (0) 2016.09.12
문자열 관련 메서드  (0) 2016.09.09
$.each jSon데이터 루프 돌기  (0) 2015.09.01

댓글