나는 기능을 구현하고있어 바인딩 동적 생성 :나 동적 <code>JavaScript</code> 테이블에 열을 추가 할 수 있도록 자바 스크립트
for(var i = 0; i < info.length; i++){
var temp = [];
temp.push(parseInt(info[i].site_id));
temp.push(info[i].site);
temp.push(info[i].site_code);
temp.push(processArray(info[i].tc10));
temp.push(processArray(info[i].tc9x_test));
temp.push(processArray(info[i].tc9x_build));
temp.push(processArray(info[i].oracle_dev));
temp.push(processArray(info[i].database));
temp.push(processArray(info[i].baseline));
temp.push(processArray(info[i].push_windows));
temp.push(processArray(info[i].push_unix));
temp.push(processArray(info[i].license));
temp.push(processArray(info[i].tcx));
temp.push(processArray(info[i].eng));
temp.push(processArray(info[i].perforce_proxy));
temp.push(processArray(info[i].volume_server));
temp.push(info[i].windows_ref_unit_location);
temp.push(info[i].unix_ref_unit_location);
temp.push(info[i].windows_rte_location);
temp.push(info[i].unix_rte_location);
temp.push(info[i].windows_toolbox_location);
temp.push(info[i].unix_toolbox_location);
temp.push(info[i].UGII_LICENSE_FILE);
temp.push(info[i].UGS_LICENSE_SERVER);
temp.push(info[i].unix_dev_units);
temp.push(info[i].unix_devop_path);
temp.push(info[i].perforce_proxy_path);
temp.push(info[i].primary_contact);
temp.push(info[i].secondary_contact);
temp.push(info[i].num_users);
temp.push(info[i].TC_12);
// check if new columns got added:
if(len > 29){
for(var j = 30; j < len; j++){
var col = columns[j];
temp.push(info[i].col);
}
}
rows.push(temp);
}
return rows;
}
var rows = [[]]
테이블 데이터를 보유를 ... info[[]]
은 쿼리 한 JSON
개체를 포함 데이터베이스 이 코드 조각에서 문제 :
for(var j = 30; j < len; j++){
var col = columns[j];
temp.push(info[i].col);
}
내가 동적으로 info
의 속성 중 일부와 col
을 결합하기 위해 노력하고있어. 하지만 가능한지 아닌지 모르겠다. 어떻게 할 수 있니? 사용자가 새 열을 추가했다고 가정하십시오. TC_12
. 따라서, TC_12
이 존재하므로, col
을 info[i]
에 동적으로 입찰하고 싶습니다. 그래서 어떻게 든 나에게 info[i].TC_12
을 양보 할 수 있습니다. 아이디어가 있으십니까?
다음과 같은 방법으로 push'es'의 큰 시리즈를 정리할 수 있습니다 그냥 리터럴에 넣어 : https://gist.github.com/3185075 – Ryan