datatype: "local" 인 상황에서

데이터를 넣는 방식이 아래와 같았다.


function setJqGrid(gridId, json, maxLine){

$(gridId).clearGridData();  // 이전 데이터 삭제

if(json.length>0){

for(var i=0; i<json.length; i++){

jQuery(gridId).jqGrid('addRowData',i+1,json[i]);

if(maxLine < i){

break;

}

}

}

}



그랬더니 엄청 느리네 ??



그래서 아래와 같이 변경하였다.


function setJqGrid(gridId, json, maxLine){

$(gridId).clearGridData();  // 이전 데이터 삭제

if(json.length>0){

jQuery(gridId).jqGrid('setGridParam',

       { 

           datatype: 'local',

           data:json

       })

   .trigger("reloadGrid");

}

}



속도 개선이 확 되었다.

결론 : jqGrid는 그렇게 느리지 않다.


'WEB > jqGrid' 카테고리의 다른 글

[jqGrid] 함수  (0) 2014.01.19
[jqGrid] 정렬 기능 정리  (0) 2014.01.19

지정된 양식에 하나의 ROW만 존재한 상황에서

두번째 줄부터는 아래와 같은 함수를 이용하여 값을 write한다.


1) ROW가 있는지 확인

 - 해당 ROW가 정해져있는 양식이 있는지 확인

 - 없으면 create row


2) Cell이 있는지 확인

 - 해당 ROW는 위에서 만들었기 때문에 존재함.

 - 해당 ROW, CELL에 정해져 있는 양식이 있는지 확인

 - 없으면 create cell 

 - 바로 위 row에서 style을 가지고와서 지정

 - 값 wirte



protected void writeLabelCell(HSSFSheet sheet, int _row, int _col, String str){

try{

HSSFRow row = sheet.getRow(_row);

if(row == null){ 

row = sheet.createRow(_row);

}

HSSFCell cell = row.getCell(_col);

if(cell == null){ // CELL이 없으면 바로 위 행의 ROW의 CELL 스타일을 가지고 옴.

HSSFRow refRow = sheet.getRow((_row-1));

HSSFCell refCell = refRow.getCell(_col);

cell = row.createCell(_col);

cell.setCellStyle(refCell.getCellStyle());

}


try{

row = sheet.getRow(_row);

cell = row.getCell(_col);

cell.setCellValue(str);

}catch(Exception e){

e.printStackTrace();

}

}catch(Exception e){

e.printStackTrace();

}

}

소개 : http://www.nextree.co.kr/p3241/


하루만에 끝내기 : http://soomong.net/blog/2014/01/20/translation-ultimate-guide-to-learning-angularjs-in-one-day/

+ Recent posts