|
|
@ -1,98 +1,6 @@
|
|
|
|
var initGrid = (gridOptions) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tableBodyTemplate = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var strThs = "";
|
|
|
|
|
|
|
|
var strBodyTrs = "";
|
|
|
|
|
|
|
|
var colCnt = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(gridOptions.rowHeader){
|
|
|
|
|
|
|
|
strThs += `<th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1"
|
|
|
|
|
|
|
|
style="width: 50px; text-align:center;">
|
|
|
|
|
|
|
|
${gridOptions.rowHeader}
|
|
|
|
|
|
|
|
</th>`;
|
|
|
|
|
|
|
|
colCnt++
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strBodyTrs += `<tr data-key="${gridOptions.trDataKey}">`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(gridOptions.rowHeader){
|
|
|
|
|
|
|
|
strBodyTrs += `<td
|
|
|
|
|
|
|
|
onclick="${gridOptions.clickEvent}"
|
|
|
|
|
|
|
|
ondblclick="${gridOptions.dblClickEvent}"
|
|
|
|
|
|
|
|
>{ROW_NUM}
|
|
|
|
|
|
|
|
</td>`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var gridColumns = gridOptions.columns;
|
|
|
|
|
|
|
|
gridColumns.forEach(function(item, idx, arr){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var gHeader = item.header;
|
|
|
|
|
|
|
|
var gName = item.name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var gWidth = item.width;
|
|
|
|
|
|
|
|
if(!gWidth){
|
|
|
|
|
|
|
|
gWidth = "0px";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var gClass = item.className;
|
|
|
|
|
|
|
|
if(!gClass){
|
|
|
|
|
|
|
|
gClass = "";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var thClass = gClass.replace("text-start","").replace("texter-center","").replace("text-end","");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var titleClickEvent = ``;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var by = gridOptions.by;
|
|
|
|
|
|
|
|
var byOutput = gridOptions.byOutput;
|
|
|
|
|
|
|
|
if(by && byOutput){
|
|
|
|
|
|
|
|
titleClickEvent += `searchFromGridTitle('${by}','${byOutput}','${gName}','${gHeader}','${item.advancedOptionIndex}');`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var gHidden = item.hidden;
|
|
|
|
|
|
|
|
if(!gHidden){
|
|
|
|
|
|
|
|
gHidden = "";
|
|
|
|
|
|
|
|
colCnt++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
gHidden = "hidden";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strThs += `<th
|
|
|
|
|
|
|
|
tabindex="0" rowspan="1" colspan="1" class="sorting text-center ${thClass}"
|
|
|
|
|
|
|
|
style="width: ${gWidth};"
|
|
|
|
|
|
|
|
${gHidden}
|
|
|
|
|
|
|
|
onclick="${titleClickEvent}"
|
|
|
|
|
|
|
|
>${gHeader}
|
|
|
|
|
|
|
|
</th>`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strBodyTrs += `<td
|
|
|
|
|
|
|
|
onclick="${gridOptions.clickEvent}"
|
|
|
|
|
|
|
|
ondblclick="${gridOptions.dblClickEvent}"
|
|
|
|
|
|
|
|
class="${gClass}"
|
|
|
|
|
|
|
|
${gHidden}
|
|
|
|
|
|
|
|
>{${gName}}
|
|
|
|
|
|
|
|
</td>`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strBodyTrs += `</tr>`;
|
|
|
|
|
|
|
|
tableBodyTemplate.found = strBodyTrs;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#"+gridOptions.theadTr).append(strThs);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var notFound = `<tr class="odd">
|
|
|
|
|
|
|
|
<td valign="top" colspan="${colCnt}" class="dataTables_empty text-center">${gridOptions.prefixName} 정보를 찾지 못했습니다.</td>
|
|
|
|
|
|
|
|
</tr>`;
|
|
|
|
|
|
|
|
tableBodyTemplate.notFound = notFound;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return tableBodyTemplate;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function searchFromGridTitle(byElement, byOutputElement, byValue, byOutputValue, advancedOptionIndex){
|
|
|
|
function searchFromGridTitle(byElement, byOutputElement, byValue, byOutputValue, advancedOptionIndex){
|
|
|
|
|
|
|
|
|
|
|
|
if(advancedOptionIndex > 0){
|
|
|
|
if(advancedOptionIndex > 0){
|
|
|
|
document.getElementById(byElement).value = "advancedOption" + advancedOptionIndex;
|
|
|
|
document.getElementById(byElement).value = "advancedOption" + advancedOptionIndex;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|